[Modeling-cvs] ProjectModeling/Modeling CustomObject.py,1.16,1.17
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-07-29 21:43:44
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv6026 Modified Files: CustomObject.py Log Message: Added full documentation for snapshot_raw(), including the special case where a fk value can get out-of-sync Index: CustomObject.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CustomObject.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CustomObject.py 28 Jul 2003 06:20:19 -0000 1.16 --- CustomObject.py 29 Jul 2003 18:42:13 -0000 1.17 *************** *** 296,299 **** --- 296,331 ---- keys are allAttributesKeys() with their corresponding values. + Special care should be taken when examining the values for primary keys + and foreign keys: + + - if your object and all its related objects are already saved in the + database, you'll get the PK's and FKs' values, as expected (a special + case exists where a FK value can get out-of-sync, see below) + + - if your object is inserted in an EditingContext but has not been saved + yet, the PK value will be its TemporaryGlobalID, since there is no way + to know the value it will get when it is saved, + + - if your object has a to-one relationship to an other object that is + inserted in an EditingContext but not saved yet, the FK's value will + be that related object's TemporaryGlobalID --for the same reason then + above. + + - Last, if the object's entity defines a foreign key involved in a + to-many relationship pointing to it but with no inverse (i.e. self's + entity has no to-one relationship using this foreign key), the + returned value will its value stored in the Database's cache managed + by the framework. In other words, this value will be exact after each + saveChanges(), and the first time the object is fetched; afterwards, + if the object on the other side modifies its relation pointing to + 'self' (e.g. removes it), the value will be out-of-sync with the + object graph and will remain as-is until the EditingContext saves its + changes again. + + Note: this method does not care about PKs or FKs being marked as class + properties. Even when they are class properties, it does NOT look at their + values, instead the returned values are extracted by examining the objects + related to 'self'. + Raises ObjectNotRegisteredError if the object itself is not registered in an EditingContext, or if any of the objects it is in relation w/ is not |