diff options
author | John Wiegley <johnw@newartisans.com> | 2009-11-20 23:23:44 -0500 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-11-20 23:23:44 -0500 |
commit | d5e957204c2799f07f9ecf868d2d846bea5682ef (patch) | |
tree | e2618ed53b09e0ea7d0d5871c237ec3b5127faae /src/py_balance.cc | |
parent | bd455c98743ce354b875d67a1d607a682d604fe0 (diff) | |
download | fork-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_balance.cc')
-rw-r--r-- | src/py_balance.cc | 8 |
1 files changed, 7 insertions, 1 deletions
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, |