[Modeling-cvs] ProjectModeling/Modeling CustomObject.py,1.15,1.16
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-07-28 06:20:27
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv6663 Modified Files: CustomObject.py Log Message: Fixed snapshot_raw(): it was raising when it comes to fill the value for a FK used in a relationship pointing to the object, with no to-one inverse relationship defined in the object's entity Index: CustomObject.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CustomObject.py,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CustomObject.py 16 Jul 2003 18:41:37 -0000 1.15 --- CustomObject.py 28 Jul 2003 06:20:19 -0000 1.16 *************** *** 314,319 **** continue ! res[key]=self.storedValueForKey(key) ! # Handle PKs gid=self.globalID() --- 314,334 ---- continue ! try: ! res[key]=self.storedValueForKey(key) ! except AttributeError: ! # This happens when it comes to fill the value for a FK used in a ! # relationship pointing to the object, with no to-one inverse ! # relationship defined in the object's entity (thus, this fk is not ! # in fks=ClassDescription.foreignKeys() ! attr=cd.entity().attributeNamed(key) ! if attr and not attr.isClassProperty(): ! if self.globalID().isTemporary(): ! # cannot compute, insert None ! res[key]=None ! else: ! db=ec.rootObjectStore().objectStoreForObject(self).database() ! snap=db.snapshotForGlobalID(self.globalID()) ! res[key]=snap[key] ! # Handle PKs gid=self.globalID() |