summaryrefslogtreecommitdiff
path: root/src/pyinterp.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-01 23:40:02 -0600
committerJohn Wiegley <johnw@newartisans.com>2012-03-01 23:40:02 -0600
commita125f24d29fd8275be7283a2edca9abc125703d7 (patch)
treeb649aeeef3b75be85cae8197467c5fb02066d486 /src/pyinterp.cc
parentcfd7ffb12645c198a5b15891654f6ad6a0e4db27 (diff)
downloadfork-ledger-a125f24d29fd8275be7283a2edca9abc125703d7.tar.gz
fork-ledger-a125f24d29fd8275be7283a2edca9abc125703d7.tar.bz2
fork-ledger-a125f24d29fd8275be7283a2edca9abc125703d7.zip
Allow --options to be added by the user in Python
Diffstat (limited to 'src/pyinterp.cc')
-rw-r--r--src/pyinterp.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/pyinterp.cc b/src/pyinterp.cc
index 048f5a39..3157079a 100644
--- a/src/pyinterp.cc
+++ b/src/pyinterp.cc
@@ -419,10 +419,19 @@ expr_t::ptr_op_t python_interpreter_t::lookup(const symbol_t::kind_t kind,
}
break;
- case symbol_t::OPTION:
+ case symbol_t::OPTION: {
if (option_t<python_interpreter_t> * handler = lookup_option(name.c_str()))
return MAKE_OPT_HANDLER(python_interpreter_t, handler);
+
+ string option_name(string("option_") + name);
+ if (is_initialized && main_nspace.has_key(option_name.c_str())) {
+ DEBUG("python.interp", "Python lookup option: " << option_name);
+
+ if (python::object obj = main_nspace.get(option_name.c_str()))
+ return WRAP_FUNCTOR(functor_t(obj, option_name));
+ }
break;
+ }
case symbol_t::PRECOMMAND: {
const char * p = name.c_str();