diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2010-12-30 17:00:48 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2010-12-30 17:00:48 +0000 |
commit | 81a3fbb8ffd089d2b2db1444f2c95d1927481d43 (patch) | |
tree | bb29ab77626d50cf2fca6ef39d59febe6462e6ca | |
parent | 2b4f7ecfa282e5bc3dcc893b25e47151f4dbdc8a (diff) | |
download | opt-utilities-81a3fbb8ffd089d2b2db1444f2c95d1927481d43.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@151 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r-- | interface/pymodel.hpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/interface/pymodel.hpp b/interface/pymodel.hpp index 5ef3885..8041a6b 100644 --- a/interface/pymodel.hpp +++ b/interface/pymodel.hpp @@ -51,21 +51,23 @@ namespace opt_utilities public: void attach(const std::string module_name, - const std::string arglist_name, + const std::string arg_name, + const std::string arg_value, const std::string func_name) { this->clear_param_info(); boost::python::object mod(boost::python::import(module_name.c_str())); pyfunc=mod.attr(func_name.c_str()); - boost::python::dict args(mod.attr(arglist_name.c_str())); - boost::python::list pnames(args.keys()); - int nparams=boost::python::len(pnames); + boost::python::list args_names(mod.attr(arg_name.c_str())); + boost::python::list args_values(mod.attr(arg_value.c_str())); + + int nparams=boost::python::len(args_names); for(size_t i=0;i!=nparams;++i) { - boost::python::object pname_obj=pnames[i]; + boost::python::object pname_obj=args_names[i]; std::string pname=boost::python::extract<std::string>(pname_obj); typename element_type_trait<Tp>::element_type pvalue= - boost::python::extract<typename element_type_trait<Tp>::element_type>(args.get(pname_obj)); + boost::python::extract<typename element_type_trait<Tp>::element_type>(args_values[i]); push_param_info(param_info<Tp,std::string>(pname,pvalue)); } |