Re: [Modeling-users] CustomObject.snapshot()
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-07-28 17:29:29
|
Hi, Since this got no further comments in almost two weeks I'll let the change happen in the next release. --> CustomObject.snapshot will return a to-many fault (AccessArrayFaultHandler) instead of None when a key holds a faulted sequence of objects, instead of None. -- S=E9bastien. > 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). >=20 > The current behaviour is (using the StoreEmployees model & test data): >=20 > >>> 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>]} >=20 >=20 > 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: >=20 >=20 > >>> pprint.pprint(circus.snapshot()) > {'corporateName': 'Flying Circus', > 'employees': <Modeling.FaultHandler.AccessArrayFaultHandler instance at = 0x8539034>} >=20 > 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. |