From b00e7ac19a096a7b736863dced616d552843ed6e Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Nov 2009 05:56:24 -0500 Subject: Added more documentation to python/demo.py --- src/py_commodity.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/py_commodity.cc') 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 py_price(annotation_t& ann) { + return ann.price; + } + boost::optional py_set_price(annotation_t& ann, + const boost::optional& price) { + return ann.price = price; + } + } // unnamed namespace void export_commodity() @@ -295,7 +303,7 @@ void export_commodity() map_value_type_converter(); - 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)) -- cgit v1.2.3