summaryrefslogtreecommitdiff
path: root/src/py_commodity.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-11-20 23:23:44 -0500
committerJohn Wiegley <johnw@newartisans.com>2009-11-20 23:23:44 -0500
commitd5e957204c2799f07f9ecf868d2d846bea5682ef (patch)
treee2618ed53b09e0ea7d0d5871c237ec3b5127faae /src/py_commodity.cc
parentbd455c98743ce354b875d67a1d607a682d604fe0 (diff)
downloadfork-ledger-d5e957204c2799f07f9ecf868d2d846bea5682ef.tar.gz
fork-ledger-d5e957204c2799f07f9ecf868d2d846bea5682ef.tar.bz2
fork-ledger-d5e957204c2799f07f9ecf868d2d846bea5682ef.zip
Fixed Ledger/Python byte vs. char Unicode bridge
Diffstat (limited to 'src/py_commodity.cc')
-rw-r--r--src/py_commodity.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/py_commodity.cc b/src/py_commodity.cc
index c201d370..984be5f0 100644
--- a/src/py_commodity.cc
+++ b/src/py_commodity.cc
@@ -232,6 +232,10 @@ namespace {
return ann.price = price;
}
+ PyObject * py_commodity_unicode(commodity_t& commodity) {
+ return str_to_py_unicode(commodity.symbol());
+ }
+
} // unnamed namespace
void export_commodity()
@@ -331,6 +335,8 @@ void export_commodity()
make_getter(&commodity_t::european_by_default),
make_setter(&commodity_t::european_by_default))
+ .def("__str__", &commodity_t::symbol)
+ .def("__unicode__", py_commodity_unicode)
.def("__nonzero__", &commodity_t::operator bool)
.def(self == self)