summaryrefslogtreecommitdiff
path: root/src/py_value.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2012-03-30 00:38:59 -0500
committerJohn Wiegley <johnw@newartisans.com>2012-03-30 00:51:06 -0500
commita1c33fec022d53c9d5831d00f26ffcc6f69a007d (patch)
tree8da37ba27076a867f1ac6a51df0f07bceb8fd9c7 /src/py_value.cc
parent8e8c2904f55eb9a43b3eb8057e9f11767a624dff (diff)
downloadfork-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_value.cc')
-rw-r--r--src/py_value.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/py_value.cc b/src/py_value.cc
index efeb4340..b931f008 100644
--- a/src/py_value.cc
+++ b/src/py_value.cc
@@ -59,6 +59,11 @@ namespace {
const datetime_t& moment) {
return value.value(moment, in_terms_of);
}
+ boost::optional<value_t> py_value_2d(const value_t& value,
+ const commodity_t * in_terms_of,
+ const date_t& moment) {
+ return value.value(datetime_t(moment), in_terms_of);
+ }
PyObject * py_base_type(value_t& value)
{
@@ -265,6 +270,7 @@ void export_value()
.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("value", &value_t::value, value_overloads())
.def("exchange_commodities", &value_t::exchange_commodities,