From d5e957204c2799f07f9ecf868d2d846bea5682ef Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Fri, 20 Nov 2009 23:23:44 -0500 Subject: Fixed Ledger/Python byte vs. char Unicode bridge --- src/py_commodity.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/py_commodity.cc') 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) -- cgit v1.2.3