Merge pull request #108 from afh/pull/python_xact_code
Fix crash when accessing the transaction code via post.xact.code using python
This commit is contained in:
commit
b74e257817
4 changed files with 14 additions and 2 deletions
|
|
@ -119,8 +119,8 @@ void export_xact()
|
||||||
.def("__str__", py_xact_to_string)
|
.def("__str__", py_xact_to_string)
|
||||||
|
|
||||||
.add_property("code",
|
.add_property("code",
|
||||||
make_getter(&xact_t::code),
|
make_getter(&xact_t::code, return_value_policy<return_by_value>()),
|
||||||
make_setter(&xact_t::code))
|
make_setter(&xact_t::code, return_value_policy<return_by_value>()))
|
||||||
.add_property("payee",
|
.add_property("payee",
|
||||||
make_getter(&xact_t::payee),
|
make_getter(&xact_t::payee),
|
||||||
make_setter(&xact_t::payee))
|
make_setter(&xact_t::payee))
|
||||||
|
|
@ -157,6 +157,8 @@ void export_xact()
|
||||||
make_getter(&period_xact_t::period_string),
|
make_getter(&period_xact_t::period_string),
|
||||||
make_setter(&period_xact_t::period_string))
|
make_setter(&period_xact_t::period_string))
|
||||||
;
|
;
|
||||||
|
|
||||||
|
register_optional_to_python<std::string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ledger
|
} // namespace ledger
|
||||||
|
|
|
||||||
3
test/regress/xact_code.dat
Normal file
3
test/regress/xact_code.dat
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
2012-11-10 (C0-d3) Payee
|
||||||
|
Assets:Checking € -12,45
|
||||||
|
Expenses:Expenditure
|
||||||
4
test/regress/xact_code.py
Normal file
4
test/regress/xact_code.py
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
import ledger
|
||||||
|
|
||||||
|
for post in ledger.read_journal('test/regress/xact_code.dat').query('expenses'):
|
||||||
|
print post.xact.code
|
||||||
3
test/regress/xact_code_py.test
Normal file
3
test/regress/xact_code_py.test
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
test python test/regress/xact_code.py
|
||||||
|
C0-d3
|
||||||
|
end test
|
||||||
Loading…
Add table
Reference in a new issue