From aa086686ea2eb4efcb4684a48de8c15a97004a80 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Nov 2009 17:40:15 -0500 Subject: Normalized the value() method for Python numerics --- src/py_amount.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/py_amount.cc') 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 - py_value_1(const amount_t& amount, commodity_t& in_terms_of) { + boost::optional py_value_0(const amount_t& amount) { + return amount.value(false, CURRENT_TIME()); + } + boost::optional py_value_1(const amount_t& amount, + commodity_t& in_terms_of) { return amount.value(false, CURRENT_TIME(), in_terms_of); } - boost::optional - py_value_2(const amount_t& amount, commodity_t& in_terms_of, - datetime_t& moment) { + boost::optional 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) -- cgit v1.2.3