summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/py_amount.cc15
-rw-r--r--python/py_times.cc2
-rw-r--r--python/py_value.cc12
3 files changed, 13 insertions, 16 deletions
diff --git a/python/py_amount.cc b/python/py_amount.cc
index 26107ce3..a12104d8 100644
--- a/python/py_amount.cc
+++ b/python/py_amount.cc
@@ -74,7 +74,8 @@ void py_parse_str_2(amount_t& amount, const string& str, unsigned char flags) {
amount.parse(str, flags);
}
-void py_print(amount_t& amount, object out) {
+void py_print(amount_t& amount, object out)
+{
if (PyFile_Check(out.ptr())) {
pyofstream outstr(reinterpret_cast<PyFileObject *>(out.ptr()));
amount.print(outstr);
@@ -84,6 +85,10 @@ void py_print(amount_t& amount, object out) {
}
}
+void py_amount_initialize() {
+ amount_t::initialize();
+}
+
#define EXC_TRANSLATOR(type) \
void exc_translate_ ## type(const type& err) { \
PyErr_SetString(PyExc_ArithmeticError, err.what()); \
@@ -94,7 +99,7 @@ EXC_TRANSLATOR(amount_error)
void export_amount()
{
class_< amount_t > ("Amount")
- .def("initialize", &amount_t::initialize)
+ .def("initialize", py_amount_initialize) // only for the PyUnitTests
.staticmethod("initialize")
.def("shutdown", &amount_t::shutdown)
.staticmethod("shutdown")
@@ -103,12 +108,6 @@ void export_amount()
make_getter(&amount_t::current_pool,
return_value_policy<reference_existing_object>()))
- .add_static_property("keep_base", &amount_t::keep_base)
-
- .add_static_property("keep_price", &amount_t::keep_price)
- .add_static_property("keep_date", &amount_t::keep_date)
- .add_static_property("keep_tag", &amount_t::keep_tag)
-
.add_static_property("stream_fullstrings",
make_getter(&amount_t::stream_fullstrings),
make_setter(&amount_t::stream_fullstrings))
diff --git a/python/py_times.cc b/python/py_times.cc
index 23532cc2..6beafe39 100644
--- a/python/py_times.cc
+++ b/python/py_times.cc
@@ -133,8 +133,6 @@ void export_times()
scope().attr("parse_datetime") = &py_parse_datetime;
scope().attr("parse_date") = &py_parse_date;
- scope().attr("current_time") = current_time;
- scope().attr("current_date") = current_date;
}
} // namespace ledger
diff --git a/python/py_value.cc b/python/py_value.cc
index 80952d7d..59be1d33 100644
--- a/python/py_value.cc
+++ b/python/py_value.cc
@@ -54,15 +54,15 @@ boost::optional<value_t> py_value_2(const value_t& amount,
return amount.value(moment, in_terms_of);
}
-string py_print(const value_t& value) {
+string py_dump(const value_t& value) {
std::ostringstream buf;
- value.print(buf);
+ value.dump(buf);
return buf.str();
}
-string py_print_relaxed(const value_t& value) {
+string py_dump_relaxed(const value_t& value) {
std::ostringstream buf;
- value.print(buf, true);
+ value.dump(buf, true);
return buf.str();
}
@@ -255,8 +255,8 @@ void export_value()
.def("to_string", &value_t::to_string)
.def("to_sequence", &value_t::to_sequence)
- .def("__str__", py_print_relaxed)
- .def("__repr__", py_print)
+ .def("__str__", py_dump_relaxed)
+ .def("__repr__", py_dump)
.def("cast", &value_t::cast)
.def("in_place_cast", &value_t::in_place_cast)