diff options
author | John Wiegley <johnw@newartisans.com> | 2009-01-28 17:16:37 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-01-28 17:16:37 -0400 |
commit | 08c7a530f8eead09802cd5f56facb93c9837fccf (patch) | |
tree | 83a745fb952d3bfbdee70a097bc8d83c106a9ace /python | |
parent | 024e10cbfad2e17e76223219cf7271557019d739 (diff) | |
download | fork-ledger-08c7a530f8eead09802cd5f56facb93c9837fccf.tar.gz fork-ledger-08c7a530f8eead09802cd5f56facb93c9837fccf.tar.bz2 fork-ledger-08c7a530f8eead09802cd5f56facb93c9837fccf.zip |
Extended the amount_t Python mapping to handle the 3rd case of value().
Diffstat (limited to 'python')
-rw-r--r-- | python/py_amount.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/python/py_amount.cc b/python/py_amount.cc index 69f4ded5..5a68b6d5 100644 --- a/python/py_amount.cc +++ b/python/py_amount.cc @@ -71,6 +71,11 @@ boost::optional<amount_t> py_value_1(const amount_t& amount, const boost::optional<datetime_t>& moment) { return amount.value(moment); } +boost::optional<amount_t> py_value_2(const amount_t& amount, + const boost::optional<datetime_t>& moment, + const boost::optional<commodity_t&>& in_terms_of) { + return amount.value(moment, in_terms_of); +} void py_parse_2(amount_t& amount, object in, unsigned char flags) { if (PyFile_Check(in.ptr())) { @@ -118,7 +123,7 @@ void export_amount() scope().attr("AMOUNT_PARSE_NO_MIGRATE") = AMOUNT_PARSE_NO_MIGRATE; scope().attr("AMOUNT_PARSE_NO_REDUCE") = AMOUNT_PARSE_NO_REDUCE; - class_< amount_t > ("amount") + class_< amount_t > ("Amount") #if 0 .def("initialize", &amount_t::initialize) .staticmethod("initialize") @@ -285,6 +290,7 @@ internal precision.") .def("value", py_value_0) .def("value", py_value_1) + .def("value", py_value_2) .def("sign", &amount_t::sign) .def("__nonzero__", &amount_t::is_nonzero) |