[PATCH] Python Bindings Transaction Imbalance

Mark Jenkins mark at parit.ca
Mon Aug 2 11:32:49 EDT 2010

Attached is a patch which fixes the python bindings support for
Transaction.GetImbalance() [xaccTransGetImbalance() ] . Right now the
value returned by the underlying C function is wrapped around
GncNumeric, whereas the C API has since changed to return MonetaryList *.

This patch adds support for MonetaryList * in src/base-typemaps.i and
uses that support in src/optional/python-bindings/gnucash_core.py with
some enhanced wrapping such that Transaction.GetImbalance() returns a
list of GncCommodity and GncNumeric pairs. A little bit of documentation
is included.

Transaction.GetImbalanceValue() is also wrapped with GncNumeric, and an
example script showing GetImbalance() and GetImbalanceValue() in action
is provided.

Mark Jenkins
ParIT Worker Co-op

cc fellow ParIT members
cc Scott
-------------- next part --------------
A non-text attachment was scrubbed...
Name: python_bindings_transaction_imbalance.patch
Type: text/x-diff
Size: 6280 bytes
Desc: not available
URL: <http://lists.gnucash.org/pipermail/gnucash-devel/attachments/20100802/c4a2b968/attachment.bin>

More information about the gnucash-devel mailing list