Creating GUID

Tom Lofts dev at loftx.co.uk
Wed Jun 5 04:22:31 EDT 2013


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 

Kind regards,

Tom

-----Original Message-----
From: gnucash-devel-bounces+dev=loftx.co.uk at gnucash.org [mailto:gnucash-devel-bounces+dev=loftx.co.uk at gnucash.org] On Behalf Of Jonas Lippuner
Sent: 05 June 2013 08:42
To: gnucash-devel at gnucash.org
Subject: Creating GUID

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi guys,

If I know the string of a GUID, how do I create the corresponding GUID object in the Python bindings for Gnucash?

The only thing I got to run is

guid = GUID()
string_to_guid("a3817efd668585e2f4431e2996683fd1", guid.__weakref__)

But this does not work since the variable guid gets a value when it is created and string_to_guid does not change that value, i.e. I just get a new guid with a random value...


Also, I noticed that it is possible to create multiple customers with the same Customer ID. Is this intentional?


Thanks for the help,
Jonas

- --
My email is signed and I encrypt email on request.
To verify my signature or send me encrypted email, get my public key: http://lippuner.ca/key -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJRruuqAAoJELH92qHy0gntz3UP/RILBVXZUTw55UjoezCcB0EQ
uYeUYyP32O0H3ghEfqOn21I56MohPyw6OWTrcSeTnOYwJ2vjDBpG532WdzJEwESq
n236qB4vKiOi2ovwGeWOW6oSeZEIpuiVGAgXIGxLuETRuvZnnZHJJNkzbG4grG2L
YgIp5P8lxXt45VKRwi0wQBcXtG0O15hpyhHjpJIdllyMN9A52Lm4suUSeq4fU5z1
XiBbvpBHG9Kfd+0xY4NiGfALOqTXi/9GB0Yf+VLVaMQ6ebHnKtKNdOFAc0XWnbMI
AI7gFzWdQjirlQAFYyBVWC9XZwTo0oHAAeoQ2AyDAGbmxx15tBzy/DHheAEQXQnR
jlHkepCyEAfyFJN5iBBazmeZc0iYJr1aUP6vSv8z1p6JBG9q+ZhbluQ/A/Yo8iJn
7s+6Ivwky07vnex7jJebtKykNoYHV14hb4A4BaYOpN7/ALsKDyMqrodGGu6WAXCn
WIenKPYFkUTthN84vBODeohQhSl3YMAUTpDatrMzHBC9Lckn7QUb7a9jFy45pvYP
rcIoKKkIZ8ST9jJgi+L5BQJmy1joFnG5HK/sbQx9XYfm2gSIceGtDIEFewV5qtCs
k/sccsdrBICZxC0kojbWsNyhxmmUcl28l1tEg/gFymbMaRLhTSfkFPZMvp6ULczg
o7WvWf4t9JLcbjeuB9ka
=bFDJ
-----END PGP SIGNATURE-----
_______________________________________________
gnucash-devel mailing list
gnucash-devel at gnucash.org
https://lists.gnucash.org/mailman/listinfo/gnucash-devel




More information about the gnucash-devel mailing list