Creating GUID

Derek Atkins warlord at MIT.EDU
Wed Jun 5 11:49:56 EDT 2013


"Tom Lofts" <dev at loftx.co.uk> writes:

> Hi Jonas,
>
> This is another recent addition, so again you'll need at least Gnucash 2.5.1. This introduces a GUIDString class which will convert a GUID to a string as follows:
>
> guid_sting = 'a3817efd668585e2f4431e2996683fd1'
> account_guid = gnucash.gnucash_core.GUID()
> gnucash.gnucash_core.GUIDString(guid_string, account_guid)
>
> You can see an example of this code in the getAccount method at https://github.com/Gnucash/gnucash/blob/trunk/src/optional/python-bindings/example_scripts/rest-api/gnucash_rest.py
>
> As an aside, I'm not entirely happy about the GUIDString class, as this should really be implemented as a method of the GUID class rather than it's own class. Any suggestions from an experinced Pythoner would be much appreciated - the relevent class is defined in https://github.com/Gnucash/gnucash/blob/trunk/src/optional/python-bindings/gnucash_core.py 

I don't understand why you cannot wrap the string_to_guid C function as
a method of the GUID object?

> Kind regards,
>
> Tom

-derek

-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord at MIT.EDU                        PGP key available


More information about the gnucash-devel mailing list