diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-20 17:40:15 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-20 17:40:15 -0500 |
commit | aa086686ea2eb4efcb4684a48de8c15a97004a80 (patch) | |
tree | ad53f1c9c3fc94717a5020602587c27fcc310cc6 /src/py_amount.cc | |
parent | b00e7ac19a096a7b736863dced616d552843ed6e (diff) | |
download | fork-ledger-aa086686ea2eb4efcb4684a48de8c15a97004a80.tar.gz fork-ledger-aa086686ea2eb4efcb4684a48de8c15a97004a80.tar.bz2 fork-ledger-aa086686ea2eb4efcb4684a48de8c15a97004a80.zip |
Normalized the value() method for Python numerics
Diffstat (limited to 'src/py_amount.cc')
-rw-r--r-- | src/py_amount.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/py_amount.cc b/src/py_amount.cc index 2307c454..09d3294e 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -44,13 +44,16 @@ using namespace boost::python; namespace { - boost::optional<amount_t> - py_value_1(const amount_t& amount, commodity_t& in_terms_of) { + boost::optional<amount_t> py_value_0(const amount_t& amount) { + return amount.value(false, CURRENT_TIME()); + } + boost::optional<amount_t> py_value_1(const amount_t& amount, + commodity_t& in_terms_of) { return amount.value(false, CURRENT_TIME(), in_terms_of); } - boost::optional<amount_t> - py_value_2(const amount_t& amount, commodity_t& in_terms_of, - datetime_t& moment) { + boost::optional<amount_t> py_value_2(const amount_t& amount, + commodity_t& in_terms_of, + datetime_t& moment) { return amount.value(false, moment, in_terms_of); } @@ -226,7 +229,8 @@ internal precision.")) .def("in_place_unreduce", &amount_t::in_place_unreduce, return_internal_reference<>()) - .def("value", py_value_1, args("moment")) + .def("value", py_value_0) + .def("value", py_value_1, args("in_terms_of")) .def("value", py_value_2, args("in_terms_of", "moment")) .def("price", &amount_t::price) |