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_account.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/py_account.cc') diff --git a/src/py_account.cc b/src/py_account.cc index d1d35cda..056cd722 100644 --- a/src/py_account.cc +++ b/src/py_account.cc @@ -32,6 +32,7 @@ #include #include "pyinterp.h" +#include "pyutils.h" #include "account.h" #include "post.h" @@ -90,6 +91,10 @@ namespace { return account.xdata(); } + PyObject * py_account_unicode(account_t& account) { + return str_to_py_unicode(account.fullname()); + } + } // unnamed namespace void export_account() @@ -180,7 +185,8 @@ void export_account() .def_readwrite("note", &account_t::note) .def_readonly("depth", &account_t::depth) - .def(self_ns::str(self)) + .def("__str__", &account_t::fullname) + .def("__unicode__", py_account_unicode) .def("fullname", &account_t::fullname) .def("partial_name", &account_t::partial_name) -- cgit v1.2.3