diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-20 05:56:24 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-20 05:56:24 -0500 |
commit | b00e7ac19a096a7b736863dced616d552843ed6e (patch) | |
tree | f2edf023d2994e95ae26eaf26dd9097003d9f7e2 /src/py_commodity.cc | |
parent | 73c3aa324b5d7ed850ded57a83a6a1e2aa33c185 (diff) | |
download | fork-ledger-b00e7ac19a096a7b736863dced616d552843ed6e.tar.gz fork-ledger-b00e7ac19a096a7b736863dced616d552843ed6e.tar.bz2 fork-ledger-b00e7ac19a096a7b736863dced616d552843ed6e.zip |
Added more documentation to python/demo.py
Diffstat (limited to 'src/py_commodity.cc')
-rw-r--r-- | src/py_commodity.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/py_commodity.cc b/src/py_commodity.cc index dfaf7f5b..c201d370 100644 --- a/src/py_commodity.cc +++ b/src/py_commodity.cc @@ -224,6 +224,14 @@ namespace { return comm.strip_annotations(keep); } + boost::optional<amount_t> py_price(annotation_t& ann) { + return ann.price; + } + boost::optional<amount_t> py_set_price(annotation_t& ann, + const boost::optional<amount_t>& price) { + return ann.price = price; + } + } // unnamed namespace void export_commodity() @@ -295,7 +303,7 @@ void export_commodity() map_value_type_converter<commodity_pool_t::commodities_map>(); - scope().attr("commodity_pool") = commodity_pool_t::current_pool; + scope().attr("commodities") = commodity_pool_t::current_pool; scope().attr("COMMODITY_STYLE_DEFAULTS") = COMMODITY_STYLE_DEFAULTS; scope().attr("COMMODITY_STYLE_SUFFIXED") = COMMODITY_STYLE_SUFFIXED; @@ -375,9 +383,7 @@ void export_commodity() .def("drop_flags", &supports_flags<>::drop_flags) #endif - .add_property("price", - make_getter(&annotation_t::price), - make_setter(&annotation_t::price)) + .add_property("price", py_price, py_set_price) .add_property("date", make_getter(&annotation_t::date), make_setter(&annotation_t::date)) |