gncEntryComputeValue exported to python?

Geert Janssens geert.gnucash at kobaltwit.be
Thu Feb 2 06:09:46 EST 2017


Op dinsdag 31 januari 2017 17:13:43 CET schreef Christoph R:
> Hi,
> 
> while trying to find a way to solve  Bug 776380 – Gross value of bills
> charged back instead of net value
> <https://bugzilla.gnome.org/show_bug.cgi?id=776380> I digged into
> gncEntry.c. My idea is to add a ?_net_price variable to struct _gncEntry
> and modify gncEntryComputeValue to calculate the net price.
> 
> To my big surprise I found gncEntryComputeValue exported as a python
> binding. Since gncEntryComputeValue operates on a private struct in
> gncEntry I cannot believe that it should be exported to python.
> 
> Anything I missed?
> 
Well, to be nitpicking it doesn't work directly on a gncEntry. It works with 
values passed in and it will optionally return 3 other values. You are correct 
though that in all sensible uses of the function the values passed in and out 
are essentially internal to a gncEntry and it would be an internal function in 
a proper OO design.

The reason for this function to appear in the language bindings is it's 
declared in a public header file and the whole file is being wrapped. I don't 
think this happened intentionally, so you can probably configure swig to 
ignore this function.

On the other hand be careful when changing the function's signature, because 
it's also used by the EntryLedger (src/business/business-ledger/
gncEntryLedger.c).

Happy hacking!

Geert


More information about the gnucash-devel mailing list