summaryrefslogtreecommitdiff
path: root/python/py_commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-01-28 20:49:26 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-01-28 20:49:26 -0400
commite851c02d2747be0acc336bc278da9e0460b75738 (patch)
treedf813c5c572922cf05a6317b7eb1d6062dedac05 /python/py_commodity.cc
parent3020f0f8513d8cef04d4a291dc9b5fa50e1b832c (diff)
downloadfork-ledger-e851c02d2747be0acc336bc278da9e0460b75738.tar.gz
fork-ledger-e851c02d2747be0acc336bc278da9e0460b75738.tar.bz2
fork-ledger-e851c02d2747be0acc336bc278da9e0460b75738.zip
Unit test for Python are now auto-generated from the C++ tests.
Diffstat (limited to 'python/py_commodity.cc')
-rw-r--r--python/py_commodity.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/python/py_commodity.cc b/python/py_commodity.cc
index 6611a900..df9cca18 100644
--- a/python/py_commodity.cc
+++ b/python/py_commodity.cc
@@ -40,6 +40,13 @@ namespace ledger {
using namespace boost::python;
+void py_add_price(commodity_t& commodity,
+ const datetime_t& date,
+ const amount_t& price)
+{
+ commodity.add_price(date, price);
+}
+
void export_commodity()
{
scope().attr("COMMODITY_STYLE_DEFAULTS") = COMMODITY_STYLE_DEFAULTS;
@@ -57,7 +64,9 @@ void export_commodity()
.def("drop_flags", &commodity_t::drop_flags)
- .add_property("precision", &commodity_t::precision)
+ .def("add_price", py_add_price)
+
+ .def("precision", &commodity_t::precision)
;
}