summaryrefslogtreecommitdiff
path: root/python/py_amount.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2009-02-04 19:55:27 -0400
committerJohn Wiegley <johnw@newartisans.com>2009-02-04 19:55:27 -0400
commit2d941730b1c60342be5b108d2d654723b3b7c2cb (patch)
tree6a3f4b7305857e85d2684670492007bafc3668d0 /python/py_amount.cc
parent73cf3b01fbd50c3a8a4fd96ff69643c28394d8fe (diff)
downloadledger-2d941730b1c60342be5b108d2d654723b3b7c2cb.tar.gz
ledger-2d941730b1c60342be5b108d2d654723b3b7c2cb.tar.bz2
ledger-2d941730b1c60342be5b108d2d654723b3b7c2cb.zip
Largely removed all of Ledger's use of global variables, for the REPL's sake.
Diffstat (limited to 'python/py_amount.cc')
-rw-r--r--python/py_amount.cc15
1 files changed, 7 insertions, 8 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))