[Modeling-users] CustomObject.snapshot()
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-07-17 11:45:41
|
Hi, Working on the ability to fetch raw rows, I incidentally found out that the snapshot method is not behaving the way I thought it was (this case was not tested and left undetermined). The current behaviour is (using the StoreEmployees model & test data): >>> ec=3DEditingContext() >>> circus=3Dec.fetch('Store', 'corporateName =3D=3D "Flying Circus"')[0] >>> circus.getEmployees().isFault() 1 >>> circus.snapshot() {'corporateName': 'Flying Circus', 'employees': None} >>> len(circus.getEmployees()) # clears the fault and fetches the array 3 >>> pprint.pprint(circus.snapshot()) {'corporateName': 'Flying Circus', 'employees': [<Modeling.GlobalID.KeyGlobalID instance at 0x8539884>, <Modeling.GlobalID.KeyGlobalID instance at 0x85271f4>, <Modeling.GlobalID.KeyGlobalID instance at 0x851ccfc>]} As you can see, when the array of 'employees' is faulted (it has not been fetched yet), it appears as None in the snapshot. It seems quite weird to me. I'd highly prefer to return something like this: >>> pprint.pprint(circus.snapshot()) {'corporateName': 'Flying Circus', 'employees': <Modeling.FaultHandler.AccessArrayFaultHandler instance at 0x= 8539034>} I'll probably change this, but I'd like to get your opinion on that, especially I'd like to know how you handle this if you're already using CustomObject.snapshot() in your own projects, and if such a modification could fit your needs. -- S=E9bastien. |