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_amount.cc | |
parent | bd455c98743ce354b875d67a1d607a682d604fe0 (diff) | |
download | ledger-d5e957204c2799f07f9ecf868d2d846bea5682ef.tar.gz ledger-d5e957204c2799f07f9ecf868d2d846bea5682ef.tar.bz2 ledger-d5e957204c2799f07f9ecf868d2d846bea5682ef.zip |
Fixed Ledger/Python byte vs. char Unicode bridge
Diffstat (limited to 'src/py_amount.cc')
-rw-r--r-- | src/py_amount.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/py_amount.cc b/src/py_amount.cc index 09d3294e..8fb507a3 100644 --- a/src/py_amount.cc +++ b/src/py_amount.cc @@ -98,6 +98,10 @@ namespace { return amount.strip_annotations(keep); } + PyObject * py_amount_unicode(amount_t& amount) { + return str_to_py_unicode(amount.to_string()); + } + } // unnamed namespace #define EXC_TRANSLATOR(type) \ @@ -248,8 +252,9 @@ internal precision.")) .def("__int__", &amount_t::to_long) .def("fits_in_long", &amount_t::fits_in_long) - .def("to_string", &amount_t::to_string) .def("__str__", &amount_t::to_string) + .def("to_string", &amount_t::to_string) + .def("__unicode__", py_amount_unicode) .def("to_fullstring", &amount_t::to_fullstring) .def("__repr__", &amount_t::to_fullstring) .def("quantity_string", &amount_t::quantity_string) |