diff options
author | John Wiegley <johnw@newartisans.com> | 2012-03-30 00:38:59 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2012-03-30 00:51:06 -0500 |
commit | a1c33fec022d53c9d5831d00f26ffcc6f69a007d (patch) | |
tree | 8da37ba27076a867f1ac6a51df0f07bceb8fd9c7 /src/py_amount.cc | |
parent | 8e8c2904f55eb9a43b3eb8057e9f11767a624dff (diff) | |
download | fork-ledger-a1c33fec022d53c9d5831d00f26ffcc6f69a007d.tar.gz fork-ledger-a1c33fec022d53c9d5831d00f26ffcc6f69a007d.tar.bz2 fork-ledger-a1c33fec022d53c9d5831d00f26ffcc6f69a007d.zip |
Allow dates to be passed to Python value() method
Diffstat (limited to 'src/py_amount.cc')
-rw-r--r-- | src/py_amount.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/py_amount.cc b/src/py_amount.cc index ea69dec5..0aa8fee8 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -56,6 +56,11 @@ namespace { const datetime_t& moment) { return amount.value(moment, in_terms_of); } + boost::optional<amount_t> py_value_2d(const amount_t& amount, + const commodity_t * in_terms_of, + const date_t& moment) { + return amount.value(datetime_t(moment), in_terms_of); + } void py_parse_2(amount_t& amount, object in, unsigned char flags) { if (PyFile_Check(in.ptr())) { @@ -238,6 +243,7 @@ internal precision.")) .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("value", py_value_2d, args("in_terms_of", "moment")) .def("price", &amount_t::price) @@ -267,6 +273,7 @@ internal precision.")) make_function(&amount_t::set_commodity, with_custodian_and_ward<1, 2>())) .def("has_commodity", &amount_t::has_commodity) + .def("with_commodity", &amount_t::with_commodity) .def("clear_commodity", &amount_t::clear_commodity) .def("number", &amount_t::number) |