diff options
author | John Wiegley <johnw@newartisans.com> | 2004-09-07 19:38:21 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2004-09-07 19:38:21 -0400 |
commit | 6126d48e279e04aaa99cc7a17cda7a9803597ac2 (patch) | |
tree | 03fb98b90a4bbaf85ee656b0f97251f4c7a15fd5 /journal.cc | |
parent | 1825c8bb1a9f394b6a2d6a9566626e403e5cac20 (diff) | |
download | fork-ledger-6126d48e279e04aaa99cc7a17cda7a9803597ac2.tar.gz fork-ledger-6126d48e279e04aaa99cc7a17cda7a9803597ac2.tar.bz2 fork-ledger-6126d48e279e04aaa99cc7a17cda7a9803597ac2.zip |
some python code fixes
Diffstat (limited to 'journal.cc')
-rw-r--r-- | journal.cc | 27 |
1 files changed, 12 insertions, 15 deletions
@@ -405,7 +405,6 @@ bool journal_t::valid() const #ifdef USE_BOOST_PYTHON #include <boost/python.hpp> -#include <boost/python/suite/indexing/vector_indexing_suite.hpp> using namespace boost::python; using namespace ledger; @@ -427,7 +426,12 @@ transaction_t& transactions_getitem(entry_t& entry, int i) throw_error_already_set(); } - return *(entry.transactions[i < 0 ? len + i : i]); + int x = i < 0 ? len + i : i; + transactions_list::iterator elem = entry.transactions.begin(); + while (--x >= 0) + elem++; + + return **elem; } unsigned int entries_len(journal_t& journal) @@ -444,7 +448,12 @@ entry_t& entries_getitem(journal_t& journal, int i) throw_error_already_set(); } - return *(journal.entries[i < 0 ? len + i : i]); + int x = i < 0 ? len + i : i; + entries_list::iterator elem = journal.entries.begin(); + while (--x >= 0) + elem++; + + return **elem; } unsigned int accounts_len(account_t& account) @@ -485,10 +494,6 @@ void export_journal() .def("valid", &transaction_t::valid) ; - class_< transactions_list > ("TransactionsList") - .def(vector_indexing_suite< transactions_list >()) - ; - class_< entry_t > ("Entry") .def_readwrite("date", &entry_t::date) .def_readwrite("state", &entry_t::state) @@ -528,14 +533,6 @@ void export_journal() .def("valid", &account_t::valid) ; - class_< entries_list > ("EntriesList") - .def(vector_indexing_suite< entries_list >()) - ; - - class_< strings_list > ("StringsList") - .def(vector_indexing_suite< strings_list >()) - ; - class_< journal_t > ("Journal") .def_readonly("sources", &journal_t::sources) |