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_balance.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/py_balance.cc') diff --git a/src/py_balance.cc b/src/py_balance.cc index 760730a7..8c0c4c58 100644 --- a/src/py_balance.cc +++ b/src/py_balance.cc @@ -105,6 +105,10 @@ namespace { return balance.strip_annotations(keep); } + PyObject * py_balance_unicode(balance_t& balance) { + return str_to_py_unicode(balance.to_string()); + } + } // unnamed namespace #define EXC_TRANSLATOR(type) \ @@ -152,7 +156,9 @@ void export_balance() .def(self != long()) .def(! self) - .def(self_ns::str(self)) + .def("__str__", &balance_t::to_string) + .def("to_string", &balance_t::to_string) + .def("__unicode__", py_balance_unicode) .def("negated", &balance_t::negated) .def("in_place_negate", &balance_t::in_place_negate, -- cgit v1.2.3