modeling-cvs Mailing List for Object-Relational Bridge for python (Page 22)
Status: Abandoned
Brought to you by:
sbigaret
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(54) |
Apr
(29) |
May
(94) |
Jun
(47) |
Jul
(156) |
Aug
(132) |
Sep
(40) |
Oct
(6) |
Nov
(18) |
Dec
(24) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(18) |
Feb
(59) |
Mar
(7) |
Apr
|
May
(8) |
Jun
(2) |
Jul
(12) |
Aug
(15) |
Sep
(12) |
Oct
(6) |
Nov
(25) |
Dec
(1) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2006 |
Jan
|
Feb
(27) |
Mar
|
Apr
(16) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv30582 Modified Files: CHANGES DatabaseChannel.py DatabaseContext.py FetchSpecification.py ObjectStoreCoordinator.py EditingContext.py Log Message: Added the ability to fetch raw rows (dictionaries instead of fully intialized objects) --see FetchSpecification.setFetchesRawRows() and EditingContext.fetch() 's parameter 'rawRows'. Also added the possibility to turn these rows into real objects --see EditingContext.faultForRawRow() Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.124 retrieving revision 1.125 diff -C2 -d -r1.124 -r1.125 *** CHANGES 16 Jul 2003 18:45:23 -0000 1.124 --- CHANGES 16 Jul 2003 19:16:00 -0000 1.125 *************** *** 8,13 **** -------------------------------------------------------- * Added CustomObject.snapshot_raw(), support for the future ability to fetch ! raw rows (dictionaries instead of fully initialized objects) * rewrote trace() statements in QualifierParser to avoid the unnecessary --- 8,18 ---- -------------------------------------------------------- + * Added the ability to fetch raw rows (dictionaries instead of fully + intialized objects) --see FetchSpecification.setFetchesRawRows() and + EditingContext.fetch() 's parameter 'rawRows'. Also added the possibility + to turn these rows into real objects --see EditingContext.faultForRawRow() + * Added CustomObject.snapshot_raw(), support for the future ability to fetch ! raw rows (see above) * rewrote trace() statements in QualifierParser to avoid the unnecessary Index: DatabaseChannel.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseChannel.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DatabaseChannel.py 6 May 2003 13:21:29 -0000 1.13 --- DatabaseChannel.py 16 Jul 2003 19:16:00 -0000 1.14 *************** *** 85,88 **** --- 85,89 ---- self._isLocking=0 self._refreshesRefreshedObject=0 + self._rawRows=0 def adaptorChannel(self): *************** *** 100,104 **** --- 101,109 ---- self.setCurrentEditingContext(None) self.__isFetchInProgress=0 + self._editingContext=None + self._currentEntity='' self._isLocking=0 + self._refreshesRefreshedObject=0 + self._rawRows=0 def databaseContext(self): *************** *** 108,111 **** --- 113,121 ---- return self._dbContext + def fetchesRawRows(self): + """ + """ + return self._rawRows + def fetchObject(self): """ *************** *** 141,144 **** --- 151,162 ---- globalID=self._currentEntity.globalIDForRow(dict) + if self.fetchesRawRows(): + ec=self._editingContext + object=ec.objectForGlobalID(globalID) + if object is not None: + return object.snapshot_raw() + else: + return dict + # Get snapshot #snapshot=self._currentEntity.snapshotForRow(dict) *************** *** 357,360 **** --- 375,379 ---- self.setIsLocking(aFetchSpecification.locksObjects()) self.setIsRefreshingObjects(aFetchSpecification.refreshesRefetchedObjects()) + self.setFetchesRawRow(aFetchSpecification.fetchesRawRows()) # Get an adaptorChannel if not self._adaptorChannel.isOpen(): *************** *** 384,387 **** --- 403,413 ---- self._currentEntity=anEntity + def setFetchesRawRow(self, aBool): + """ + This is automatically called by selectObjectsWithFetchSpecification(), + according to the settings of the FetchSpecification the latter method got. + """ + self._rawRows=not not aBool + def setIsLocking(self, isLocking): """ Index: DatabaseContext.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/DatabaseContext.py,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** DatabaseContext.py 12 Jun 2003 09:35:19 -0000 1.16 --- DatabaseContext.py 16 Jul 2003 19:16:00 -0000 1.17 *************** *** 346,349 **** --- 346,350 ---- def database(self): """ + returns Database object bound to this databaseContext """ return self._database *************** *** 1214,1221 **** def faultForRawRow(self, row, entityName, anEditingContext): """ ! Unimplemented ! """ ! self.__unimplemented__() def handlesObject(self, anObject): """ --- 1215,1245 ---- def faultForRawRow(self, row, entityName, anEditingContext): """ ! Turns a row (dictionary) into a real object. Any row, such as the one ! returned by a fetch when raw rows is activated, can be turned into a ! real object given that it contains the primary keys. ! ! Parameters: ! ! row -- a dictionary. This dictionary should have the entity's primary ! keys in its keys (and their corresponding values) ! ! entityName -- the name of the entity the row represents ! ! anEditingContext -- The EditingContext in which the object should be ! registered. Defaults to self if None or omitted. + See also: EditingContext.fetch(), FetchSpecification.setFetchesRawRows + + """ + entity=self._database.entityNamed(entityName) + pks_names=entity.primaryKeyAttributeNames() + pks={} + for pk in pks_names: + if not row.has_key(pk): + raise ValueError("Cannot convert row to object: row should at least contain entity %s's primary key(s) but pk '%s' is not there"%(entityName, pk)) + pks[pk]=row[pk] + gid=KeyGlobalID(entityName, pks) + return self.faultForGlobalID(gid, anEditingContext) + def handlesObject(self, anObject): """ *************** *** 1250,1258 **** snapshot=self._database.snapshotForGlobalID(aGlobalID) - #db=self.database() - #db.incrementSnapshotCountForGlobalID(aGlobalID) - #import pdb ; pdb.set_trace() - #attrsNames=map(lambda o: o.name(), attrs) aDatabaseObject.prepareForInitializationWithKeys(classPropsNames) for attr in attrs: --- 1274,1278 ---- *************** *** 1265,1271 **** # faults initialization ! cd=aDatabaseObject.classDescription() for rel in rels: ! destCD=cd.classDescriptionForDestinationKey(rel.name()) # Now we have to initialize the object's relationships --- 1285,1292 ---- # faults initialization ! ! #cd=aDatabaseObject.classDescription() for rel in rels: ! #destCD=cd.classDescriptionForDestinationKey(rel.name()) # Now we have to initialize the object's relationships Index: FetchSpecification.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/FetchSpecification.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FetchSpecification.py 14 Mar 2003 11:40:08 -0000 1.4 --- FetchSpecification.py 16 Jul 2003 19:16:00 -0000 1.5 *************** *** 59,62 **** --- 59,63 ---- self._refreshesRefreshedObject=0 self._locksObjects=0 + self._rawRows=0 def distinctFlag(self): *************** *** 66,69 **** --- 67,73 ---- return self._entityName + def fetchesRawRows(self): + return self._rawRows + def fetchLimit(self): return self._fetchLimit *************** *** 84,87 **** --- 88,94 ---- self._entityName=entityName + def setFetchesRawRows(self, aBool): + self._rawRows=not not aBool + def setFetchLimit(self, limit): assert(limit>=0) Index: ObjectStoreCoordinator.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ObjectStoreCoordinator.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ObjectStoreCoordinator.py 14 Mar 2003 11:40:09 -0000 1.9 --- ObjectStoreCoordinator.py 16 Jul 2003 19:16:00 -0000 1.10 *************** *** 257,269 **** Private method returning the 1st cooperating store answering positively to message 'ownsGlobalID'. Called by 'objectStoreForGlobalID'. """ ! self.lock() ! try: ! for store in self._cooperatingObjectStores: ! if store.ownsGlobalID(aGlobalID): ! return store ! return None ! finally: ! self.unlock() def objectStoreForGlobalID(self, aGlobalID): --- 257,269 ---- Private method returning the 1st cooperating store answering positively to message 'ownsGlobalID'. Called by 'objectStoreForGlobalID'. + + Note: This method does not lock self. Do not call tyis by hand in a + mutli-threaded env. + """ ! for store in self._cooperatingObjectStores: ! if store.ownsGlobalID(aGlobalID): ! return store ! return None def objectStoreForGlobalID(self, aGlobalID): *************** *** 360,364 **** """ Forwards the message to the adequate CooperatingObjectStore, usually a ! DatabaseContext, and returns the result """ self.lock() --- 360,364 ---- """ Forwards the message to the adequate CooperatingObjectStore, usually a ! DatabaseContext, and returns the result. """ self.lock() *************** *** 368,372 **** finally: self.unlock() ! def initializeObject(self, anObject, aGlobalID, anEditingContext): "See ObjectStore for details" --- 368,386 ---- finally: self.unlock() ! ! def faultForRawRow(self, row, entityName, anEditingContext): ! """ ! Forwards the message to the adequate CooperatingObjectStore, usually a ! DatabaseContext, and returns the result. ! """ ! self.lock() ! try: ! from Modeling.FetchSpecification import FetchSpecification ! fs=FetchSpecification(entityName) ! store=self.objectStoreForFetchSpecification(fs) ! return store.faultForRawRow(row, entityName, anEditingContext) ! finally: ! self.unlock() ! def initializeObject(self, anObject, aGlobalID, anEditingContext): "See ObjectStore for details" Index: EditingContext.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/EditingContext.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** EditingContext.py 16 Jul 2003 08:45:45 -0000 1.25 --- EditingContext.py 16 Jul 2003 19:16:00 -0000 1.26 *************** *** 1064,1067 **** --- 1064,1092 ---- anEditingContext) + def faultForRawRow(self, row, entityName, anEditingContext=None): + """ + Turns a row (dictionary) into a real object. Any row, such as the one + returned by a fetch when raw rows is actvated, can be turned into a + real object given that it contains the primary keys. + + Parameters: + + row -- a dictionary. This dictionary should have the entity's primary + keys in its keys (and their corresponding values) + + entityName -- the name of the entity the row represents + + anEditingContext -- (optional) The EditingContext in which the object + should be registered. Defaults to self if None or omitted. + + """ + if anEditingContext is None: + anEditingContext=self + + # no particular action for the child, faultForGlobalID() will handle + # everything automatically + return self.parentObjectStore().faultForRawRow(row, entityName, + anEditingContext) + def initializeObject(self, anObject, aGlobalID, anEditingContext): """ *************** *** 1227,1248 **** # do not include deleted objects in the returned set of objects ! if ec.isaChildOf(self): ! ! # If we're returning objects for a child's use, we remove the one ! # that are marked for deletion in the parent (self) However, the ! # deleted objects in self and the ones in the child-ec are distinct, ! # but the GlobalIDs are the same and this is what we do here: ! # compare the gIDs and remove the apropriate objects from the result ! # set ec_deletedGids=self._deletedObjects+self._pendingDeletedObjects ! objects=[o for o in objects ! if ec.globalIDForObject(o) not in ec_deletedGids] ! ! else: ! # We work for self, so we just remove the ones that are already ! # marked as deleted ! ec_deletedObjects = self.allDeletedObjects() ! objects=[o for o in objects if o not in ec_deletedObjects] ! # now append inserted objects for entityName in entitiesNames: --- 1252,1292 ---- # do not include deleted objects in the returned set of objects ! if not fs.fetchesRawRows(): ! ! #TBD Implementation note: the two blocks below (if isaChildOf/else) ! #TBD are completely equivalent. Well, at least, the first one works ! #TBD for both. Is it slower/better than ! ! if ec.isaChildOf(self): ! # If we're returning objects for a child's use, we remove the one ! # that are marked for deletion in the parent (self) However, the ! # deleted objects in self and the ones in the child-ec are distinct, ! # but the GlobalIDs are the same and this is what we do here: ! # compare the gIDs and remove the apropriate objects from the result ! # set ! ec_deletedGids=self._deletedObjects+self._pendingDeletedObjects ! objects=[o for o in objects ! if ec.globalIDForObject(o) not in ec_deletedGids] ! else: ! # We work for self, so we just remove the ones that are already ! # marked as deleted ! ec_deletedObjects = self.allDeletedObjects() ! objects=[o for o in objects if o not in ec_deletedObjects] ! ! else: # We're fetching raw rows. Wow, now we have to remove from the ! # list the dictionaries corresponding to the deleted objects. ! # Note: we use the exact same code when we're working for us (self) ! # or for a child --this is basically manipulations of ! # GlobalIDs ec_deletedGids=self._deletedObjects+self._pendingDeletedObjects ! ec_deleted_raw_pks=[gid.keyValues() for gid in ec_deletedGids] ! #if ec_deletedGids: import pdb ; pdb.set_trace() ! for deleted_raw_pk in ec_deleted_raw_pks: ! for raw_obj in list(objects): ! raw_obj_copy=raw_obj.copy() ! raw_obj_copy.update(deleted_raw_pk) ! if raw_obj_copy==raw_obj: ! objects.remove(raw_obj) ! # now append inserted objects for entityName in entitiesNames: *************** *** 1262,1265 **** --- 1306,1312 ---- objs=fault_objs + if fs.fetchesRawRows(): + objs=[o.snapshot_raw() for o in objs] + objects.extend(objs) *************** *** 1275,1278 **** --- 1322,1326 ---- #page=None, # > slice parameters, not in core yet #offset=None, # / (page/offset: mutually exclusive) + rawRows=0 # should we return raw rows ): """ *************** *** 1297,1300 **** --- 1345,1349 ---- from Modeling.FetchSpecification import FetchSpecification fs=FetchSpecification(entityName, qualifier=qualifier, deepFlag=isDeep) + fs.setFetchesRawRows(rawRows) #fs.setLocksObject(lock) #fs.setRefreshesRefetchedObjects(refresh) |
From: <sbi...@us...> - 2003-07-16 19:05:43
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv28447 Modified Files: test_EditingContext_Global.py Log Message: Forgot to include the tests for faults Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** test_EditingContext_Global.py 16 Jul 2003 18:45:24 -0000 1.28 --- test_EditingContext_Global.py 16 Jul 2003 19:05:37 -0000 1.29 *************** *** 982,986 **** fdard.setLastName(alternate_fdard_name) self.assertEqual(fdard.snapshot_raw()['lastName'], alternate_fdard_name) ! def test_999_customSQLQuery(self): "[EditingContext] customSQLQuery" --- 982,993 ---- fdard.setLastName(alternate_fdard_name) self.assertEqual(fdard.snapshot_raw()['lastName'], alternate_fdard_name) ! ! # Faults ! fdard_gid=fdard.globalID() ! ec=EditingContext() ! fdard=ec.faultForGlobalID(fdard_gid, ec) ! self.failUnless(fdard.isFault()) ! self.assertEqual(fdard.snapshot_raw()['lastName'], fdard_name) ! def test_999_customSQLQuery(self): "[EditingContext] customSQLQuery" |
From: <sbi...@us...> - 2003-07-16 18:45:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv24919 Modified Files: CHANGES Log Message: Added CustomObject.snapshot_raw(), support for the future ability to fetch raw rows (see above) Added primaryKeys() and foreignKeys() to [Entity]ClassDescription Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.123 retrieving revision 1.124 diff -C2 -d -r1.123 -r1.124 *** CHANGES 14 Jul 2003 12:14:16 -0000 1.123 --- CHANGES 16 Jul 2003 18:45:23 -0000 1.124 *************** *** 8,11 **** --- 8,14 ---- -------------------------------------------------------- + * Added CustomObject.snapshot_raw(), support for the future ability to fetch + raw rows (dictionaries instead of fully initialized objects) + * rewrote trace() statements in QualifierParser to avoid the unnecessary formatting of its arguments when it is not enabled. On my machine this |
From: <sbi...@us...> - 2003-07-16 18:45:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/interfaces In directory sc8-pr-cvs1:/tmp/cvs-serv24919/interfaces Modified Files: ClassDescription.py Log Message: Added CustomObject.snapshot_raw(), support for the future ability to fetch raw rows (see above) Added primaryKeys() and foreignKeys() to [Entity]ClassDescription Index: ClassDescription.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/interfaces/ClassDescription.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClassDescription.py 14 Mar 2003 11:40:11 -0000 1.5 --- ClassDescription.py 16 Jul 2003 18:45:24 -0000 1.6 *************** *** 158,163 **** --- 158,174 ---- "" + def foreignKeys(self): + """ + Returns the names of foreign keys for the object, i.e. the source + attributes' names of to-one relationships. + + See also: toOneRelationshipKeys(), allToOneRelationshipKeys() + """ + def inverseForRelationshipKey(self, aKey): "" + + def primaryKeys(self): + "Returns the names of primary keys for the object" def propagateDeleteForObject(self, anObject, editingContext): |
From: <sbi...@us...> - 2003-07-16 18:45:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv24919/tests Modified Files: test_EditingContext_Global.py Log Message: Added CustomObject.snapshot_raw(), support for the future ability to fetch raw rows (see above) Added primaryKeys() and foreignKeys() to [Entity]ClassDescription Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** test_EditingContext_Global.py 10 Jul 2003 11:57:55 -0000 1.27 --- test_EditingContext_Global.py 16 Jul 2003 18:45:24 -0000 1.28 *************** *** 931,934 **** --- 931,986 ---- self.failUnless('Cleese' in objects_names) + def test_20_snapshot(self): + "[EditingContext] snapshot: TBD" + pass + + def test_21_snapshot_raw(self): + "[EditingContext] snapshot_raw" + ec=EditingContext() + + # saved objects, related to other saved objects + raw_fdard=ec.fetch('Writer', 'age == 82', rawRows=1)[0] + fdard=ec.fetch('Writer', 'age == 82')[0] + fdard_snapshot_raw=fdard.snapshot_raw() + self.assertEqual(raw_fdard, fdard_snapshot_raw) + + # new object, related to saved objects + w=Writer(); w.setFirstName('F'), w.setLastName('L') + ec.insert(w) + w.setPygmalion(fdard) + w_sr=w.snapshot_raw() + self.assertEqual(w_sr.keys(), fdard_snapshot_raw.keys()) + self.assertEqual(w_sr['FK_Writer_id'], fdard.globalID().keyValues()['id']) + self.assertEqual(w_sr['id'], w.globalID()) + w.setPygmalion(None) + ec.delete(w) + + # saved object, related to a new object + w=Writer(); w.setFirstName('F'), w.setLastName('L') + ec.insert(w) + rabelais=fdard.getPygmalion() + fdard.setPygmalion(w) + self.assertEqual(fdard.snapshot_raw().keys(), fdard_snapshot_raw.keys()) + self.assertEqual(fdard.snapshot_raw()['FK_Writer_id'], w.globalID()) + fdard.setPygmalion(rabelais) + ec.delete(w) + + # new object, related to new objects + w1=Writer(); w1.setFirstName('F'), w1.setLastName('L') + w2=Writer(); w2.setFirstName('F'), w2.setLastName('L') + ec.insert(w1) + ec.insert(w2) + w1.setPygmalion(w2) + self.assertEqual(w1.snapshot_raw().keys(), fdard_snapshot_raw.keys()) + self.assertEqual(w1.snapshot_raw()['id'], w1.globalID()) + self.assertEqual(w1.snapshot_raw()['FK_Writer_id'], w2.globalID()) + ec.delete(w1); ec.delete(w2) + + # modified object + fdard_name=fdard.getLastName() + alternate_fdard_name=fdard_name+' -- testing' + fdard.setLastName(alternate_fdard_name) + self.assertEqual(fdard.snapshot_raw()['lastName'], alternate_fdard_name) + def test_999_customSQLQuery(self): "[EditingContext] customSQLQuery" |
From: <sbi...@us...> - 2003-07-16 18:41:40
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv24171 Modified Files: ClassDescription.py EntityClassDescription.py CustomObject.py Log Message: Added CustomObject.snapshot_raw(), support for the future ability to fetch raw rows (dictionaries instead of fully initialized objects) Added primaryKeys() and foreignKeys() to [Entity]ClassDescription |
From: <sbi...@us...> - 2003-07-16 08:45:49
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv17748 Modified Files: EditingContext.py Log Message: Fixed: objectsWithFetchSpecification() was trying to remove the very same set of deleted objects from the result set, once for each entity of the FetchSpecification. While this was not buggy, this was useless, and causing a unnecessary waste of cpu resources when the fetch was made against a big class/entity hierarchy (and, of course, when the fetch specification is deep). Index: EditingContext.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/EditingContext.py,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** EditingContext.py 3 Jul 2003 23:03:38 -0000 1.24 --- EditingContext.py 16 Jul 2003 08:45:45 -0000 1.25 *************** *** 1226,1252 **** entitiesNames+=entity.allSubEntitiesNames() for entityName in entitiesNames: - # do not include deleted objects in the returned set of objects ec_insertedObjects = self.allInsertedObjects() - - if ec.isaChildOf(self): - - # If we're returning objects for a child's use, we remove the one - # that are marked for deletion in the parent (self) However, the - # deleted objects in self and the ones in the child-ec are distinct, - # but the GlobalIDs are the same and this is what we do here: - # compare the gIDs and remove the apropriate objects from the result - # set - ec_deletedGids=self._deletedObjects+self._pendingDeletedObjects - objects=[o for o in objects - if ec.globalIDForObject(o) not in ec_deletedGids] - - else: - # We work for self, so we just remove the ones that are already - # marked as deleted - ec_deletedObjects = self.allDeletedObjects() - objects=[o for o in objects if o not in ec_deletedObjects] - - # now append inserted objects objs=[o for o in ec_insertedObjects if o.entityName()==entityName] if fs.qualifier(): --- 1226,1251 ---- entitiesNames+=entity.allSubEntitiesNames() + # do not include deleted objects in the returned set of objects + if ec.isaChildOf(self): + + # If we're returning objects for a child's use, we remove the one + # that are marked for deletion in the parent (self) However, the + # deleted objects in self and the ones in the child-ec are distinct, + # but the GlobalIDs are the same and this is what we do here: + # compare the gIDs and remove the apropriate objects from the result + # set + ec_deletedGids=self._deletedObjects+self._pendingDeletedObjects + objects=[o for o in objects + if ec.globalIDForObject(o) not in ec_deletedGids] + + else: + # We work for self, so we just remove the ones that are already + # marked as deleted + ec_deletedObjects = self.allDeletedObjects() + objects=[o for o in objects if o not in ec_deletedObjects] + + # now append inserted objects for entityName in entitiesNames: ec_insertedObjects = self.allInsertedObjects() objs=[o for o in ec_insertedObjects if o.entityName()==entityName] if fs.qualifier(): |
From: <sbi...@us...> - 2003-07-15 11:07:13
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv4185/tests Modified Files: test_EditingContext_Global_Inheritance.py Log Message: Fixed: test_03_toOneFault_notifications() was causing an overflow on VARCHAR(20) storeArea attribute, after multiple runs Index: test_EditingContext_Global_Inheritance.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global_Inheritance.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** test_EditingContext_Global_Inheritance.py 7 Jul 2003 14:57:14 -0000 1.13 --- test_EditingContext_Global_Inheritance.py 15 Jul 2003 11:07:10 -0000 1.14 *************** *** 132,136 **** sqlExpr=pgAdaptor.expressionClass()() ! new_store_area=johnJr_1.getStoreArea()+'X' sqlExpr.setStatement("update SALES_CLERK set STORE_AREA='%s' where id=%i"\ %(new_store_area, gid_1.keyValues().values()[0])) --- 132,140 ---- sqlExpr=pgAdaptor.expressionClass()() ! original_store_area=johnJr_1.getStoreArea() ! if original_store_area=='AB': ! new_store_area='AC' ! else: ! new_store_area='AB' sqlExpr.setStatement("update SALES_CLERK set STORE_AREA='%s' where id=%i"\ %(new_store_area, gid_1.keyValues().values()[0])) *************** *** 142,146 **** johnJr_2.willRead() # Note: This also check that john2_Jr is of the correct class. ! self.failIf(johnJr_2.getStoreArea()!=johnJr_1.getStoreArea()) def test_04_validation(self): --- 146,151 ---- johnJr_2.willRead() # Note: This also check that john2_Jr is of the correct class. ! self.failIf(johnJr_2.getStoreArea()!=original_store_area) ! self.failIf(johnJr_1.getStoreArea()!=original_store_area) def test_04_validation(self): |
From: <sbi...@us...> - 2003-07-15 09:31:02
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv24334 Modified Files: QualifierParser.py Log Message: some cleaning Index: QualifierParser.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/QualifierParser.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** QualifierParser.py 14 Jul 2003 12:14:16 -0000 1.10 --- QualifierParser.py 15 Jul 2003 09:30:59 -0000 1.11 *************** *** 72,79 **** from Qualifier import * ! import string, sys ! def trace(string, *args): ! #print string%args pass --- 72,79 ---- from Qualifier import * ! import string ! def trace(msg, *args): ! #print msg%args pass *************** *** 542,546 **** def qualifierWithQualifierFormat(anExpression): "Used by Qualifier.qualifierFromQualifierFormat" ! from StringIO import StringIO strIO=StringIO(anExpression) sc=scan(strIO) --- 542,546 ---- def qualifierWithQualifierFormat(anExpression): "Used by Qualifier.qualifierFromQualifierFormat" ! from cStringIO import StringIO strIO=StringIO(anExpression) sc=scan(strIO) *************** *** 556,560 **** try: if result.__class__ not in (KeyValueQualifier, KeyComparisonQualifier, ! AndQualifier, OrQualifier, NotQualifier): raise ValueError, 'Syntax error' except: --- 556,560 ---- try: if result.__class__ not in (KeyValueQualifier, KeyComparisonQualifier, ! AndQualifier, OrQualifier, NotQualifier): raise ValueError, 'Syntax error' except: |
From: <sbi...@us...> - 2003-07-14 12:14:19
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv15739 Modified Files: CHANGES QualifierParser.py Log Message: rewrote trace() statements in QualifierParser to avoid the unnecessary formatting of its arguments when it is not enabled. On my machine this speeds up the parsing of qualifiers strings up to x7. Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.122 retrieving revision 1.123 diff -C2 -d -r1.122 -r1.123 *** CHANGES 10 Jul 2003 11:57:54 -0000 1.122 --- CHANGES 14 Jul 2003 12:14:16 -0000 1.123 *************** *** 8,11 **** --- 8,15 ---- -------------------------------------------------------- + * rewrote trace() statements in QualifierParser to avoid the unnecessary + formatting of its arguments when it is not enabled. On my machine this + speeds up the parsing of qualifiers strings up to x7. + * Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', 'OR' and 'NOT' can now be written with lower-case characters. Index: QualifierParser.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/QualifierParser.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** QualifierParser.py 10 Jul 2003 11:57:55 -0000 1.9 --- QualifierParser.py 14 Jul 2003 12:14:16 -0000 1.10 *************** *** 60,63 **** --- 60,65 ---- comp_op ::= <= comp_op ::= != + comp_op ::= IN + comp_op ::= NOT IN operator ::= AND operator ::= OR *************** *** 70,79 **** from Qualifier import * ! import string ! #import Qualifier ! def trace(string): pass - #print string # --- 72,80 ---- from Qualifier import * ! import string, sys ! def trace(string, *args): ! #print string%args pass # *************** *** 156,160 **** r' \( ' #trace('paren_close %s'%self.rv ! trace('Token paren_open: %s'%s) self.rv.append(Token(type='paren_open')) --- 157,161 ---- r' \( ' #trace('paren_close %s'%self.rv ! trace('Token paren_open: %s',s) self.rv.append(Token(type='paren_open')) *************** *** 162,191 **** r' \) ' #trace('paren_close %s'%self.rv ! trace('Token paren_close: %s'%s) self.rv.append(Token(type='paren_close')) def t_operator(self, s): r' AND | and | OR | or ' ! trace('Token Operator: %s'%s) self.rv.append(Token(type=s.upper())) def t_not_operator(self, s): r' NOT | not ' ! trace('Token NOT: %s'%s) self.rv.append(Token(type=s.upper())) def t_comp_op(self, s): r' \+ | \* | == | >= | > | <= | < | \!= | like | caseInsensitiveLike | ilike ' ! trace('Token COMP_OP: %s'%s) self.rv.append(Token(type=s)) def t_comp_op2(self, s): r' in | IN ' ! trace('Token COMP_OP2: %s'%s) self.rv.append(Token(type=s.lower())) def t_number(self, s): r' \d+ ' ! trace('Token number: %s'%s) t = Token(type='number', attr=s) self.rv.append(t) --- 163,192 ---- r' \) ' #trace('paren_close %s'%self.rv ! trace('Token paren_close: %s',s) self.rv.append(Token(type='paren_close')) def t_operator(self, s): r' AND | and | OR | or ' ! trace('Token Operator: %s',s) self.rv.append(Token(type=s.upper())) def t_not_operator(self, s): r' NOT | not ' ! trace('Token NOT: %s',s) self.rv.append(Token(type=s.upper())) def t_comp_op(self, s): r' \+ | \* | == | >= | > | <= | < | \!= | like | caseInsensitiveLike | ilike ' ! trace('Token COMP_OP: %s',s) self.rv.append(Token(type=s)) def t_comp_op2(self, s): r' in | IN ' ! trace('Token COMP_OP2: %s',s) self.rv.append(Token(type=s.lower())) def t_number(self, s): r' \d+ ' ! trace('Token number: %s',s) t = Token(type='number', attr=s) self.rv.append(t) *************** *** 193,197 **** def t_float(self, s): r' \d+ \. \d+ ' ! trace('Token float: %s'%s) t = Token(type='float', attr=s) self.rv.append(t) --- 194,198 ---- def t_float(self, s): r' \d+ \. \d+ ' ! trace('Token float: %s',s) t = Token(type='float', attr=s) self.rv.append(t) *************** *** 199,203 **** def t_string(self, s): r' \"[^\"]*\" ' ! trace('Token string: %s'%s) t = Token(type='string', attr=s[1:-1]) self.rv.append(t) --- 200,204 ---- def t_string(self, s): r' \"[^\"]*\" ' ! trace('Token string: %s',s) t = Token(type='string', attr=s[1:-1]) self.rv.append(t) *************** *** 205,209 **** def t_nullValue(self, s): r' NULL | None ' ! trace('Token string: %s'%s) t = Token(type='nullValue', attr=None) self.rv.append(t) --- 206,210 ---- def t_nullValue(self, s): r' NULL | None ' ! trace('Token string: %s',s) t = Token(type='nullValue', attr=None) self.rv.append(t) *************** *** 212,216 **** def t_z_keypath(self, s): r' [a-zA-Z][a-zA-Z0-9_\.]+ ' ! trace('Token keyPath: %s'%s) t = Token(type='keypath', attr=s) self.rv.append(t) --- 213,217 ---- def t_z_keypath(self, s): r' [a-zA-Z][a-zA-Z0-9_\.]+ ' ! trace('Token keyPath: %s',s) t = Token(type='keypath', attr=s) self.rv.append(t) *************** *** 218,237 **** def t_square_bracket_open(self, s): r' \[ ' ! trace('Token square_bracket_open: %s'%s) self.rv.append(Token(type='square_bracket_open')) def t_square_bracket_close(self, s): r' \] ' ! trace('Token square_bracket_close: %s'%s) self.rv.append(Token(type='square_bracket_close')) def t_comma(self, s): r' , ' ! trace('Token comma: %s'%s) self.rv.append(Token(type='comma')) #def t_simplekeypath(self, s): # r' \c+ ' ! # trace('Token simpleKeyPath: %s'%s) # t = Token(type='keypath', attr=s) # self.rv.append(t) --- 219,238 ---- def t_square_bracket_open(self, s): r' \[ ' ! trace('Token square_bracket_open: %s',s) self.rv.append(Token(type='square_bracket_open')) def t_square_bracket_close(self, s): r' \] ' ! trace('Token square_bracket_close: %s',s) self.rv.append(Token(type='square_bracket_close')) def t_comma(self, s): r' , ' ! trace('Token comma: %s',s) self.rv.append(Token(type='comma')) #def t_simplekeypath(self, s): # r' \c+ ' ! # trace('Token simpleKeyPath: %s',s) # t = Token(type='keypath', attr=s) # self.rv.append(t) *************** *** 239,243 **** #def t_compoundkeypath(self, s): # r' \c+ ( \. \c+ )+' ! # trace('Token compound: %s'%s) # t = Token(type='keypath', attr=s) # self.rv.append(t) --- 240,244 ---- #def t_compoundkeypath(self, s): # r' \c+ ( \. \c+ )+' ! # trace('Token compound: %s',s) # t = Token(type='keypath', attr=s) # self.rv.append(t) *************** *** 257,266 **** def error(self, token): ! trace("Syntax error sur token: `%s'" % token) raise ValueError, "Syntax error near token: `%s'" % token def p_qual_1(self, args): r' qual ::= qual operator qual ' ! trace('p_qual_1 %s/%s/%s'%(args[0], args[1], args[2])) return AST(type=args[1], left=args[0], --- 258,267 ---- def error(self, token): ! trace("Syntax error sur token: `%s'",token) raise ValueError, "Syntax error near token: `%s'" % token def p_qual_1(self, args): r' qual ::= qual operator qual ' ! trace('p_qual_1 %s/%s/%s', args[0], args[1], args[2]) return AST(type=args[1], left=args[0], *************** *** 269,273 **** def p_qual_2(self, args): r' qual ::= paren_open qual paren_close ' ! trace('paren qual:%s (%s-%s-%s)'%(args[1],args[1].left,args[1].type,args[1].right)) #inside=AST(args[0]) return AST(Token('paren', args[1])) --- 270,274 ---- def p_qual_2(self, args): r' qual ::= paren_open qual paren_close ' ! trace('paren qual:%s (%s-%s-%s)',args[1],args[1].left,args[1].type,args[1].right) #inside=AST(args[0]) return AST(Token('paren', args[1])) *************** *** 275,284 **** def p_qual_3(self, args): r' qual ::= expr ' ! trace('qual_3: %s'%args[0]) return args[0] def p_expr_1(self, args): r' expr ::= expr comp_op expr ' ! trace('p_expr_1 %s/%s/%s'%(args[0], args[1], args[2])) return AST(type=args[1], left=args[0], --- 276,285 ---- def p_qual_3(self, args): r' qual ::= expr ' ! trace('qual_3: %s',args[0]) return args[0] def p_expr_1(self, args): r' expr ::= expr comp_op expr ' ! trace('p_expr_1 %s/%s/%s',args[0], args[1], args[2]) return AST(type=args[1], left=args[0], *************** *** 287,291 **** def p_expr_in(self, args): r' expr ::= expr comp_op2 square_bracket_open comma_separated square_bracket_close ' ! trace('p_expr_1a %s/%s/%s/%s/%s'%(args[0],args[1],args[2],args[3],args[4])) return AST(type=args[1], left=args[0], --- 288,292 ---- def p_expr_in(self, args): r' expr ::= expr comp_op2 square_bracket_open comma_separated square_bracket_close ' ! trace('p_expr_1a %s/%s/%s/%s/%s',args[0],args[1],args[2],args[3],args[4]) return AST(type=args[1], left=args[0], *************** *** 294,298 **** def p_expr_not_in(self, args): r' expr ::= expr not_in square_bracket_open comma_separated square_bracket_close ' ! trace('p_expr_1a %s/%s/%s/%s/%s'%(args[0],args[1],args[2],args[3],args[4])) return AST(type=args[1], left=args[0], --- 295,299 ---- def p_expr_not_in(self, args): r' expr ::= expr not_in square_bracket_open comma_separated square_bracket_close ' ! trace('p_expr_1a %s/%s/%s/%s/%s',args[0],args[1],args[2],args[3],args[4]) return AST(type=args[1], left=args[0], *************** *** 301,315 **** def p_not_in(self, args): r' not_in ::= not_operator comp_op2 ' ! trace('p_not_in %s %s'%(args[0],args[1])) return AST(Token('not_in')) def p_comma_separated_1(self, args): r' comma_separated ::= term ' ! trace('p_comma_separated_1 %s'%args[0]) return AST(Token('comma_separated', [args[0]])) def p_comma_separated_2(self, args): r' comma_separated ::= comma_separated comma term' ! trace('p_comma_separated_2 %s %s'%(args[0], args[2])) l=args[0].attr[:] l.append(args[2]) --- 302,316 ---- def p_not_in(self, args): r' not_in ::= not_operator comp_op2 ' ! trace('p_not_in %s %s',args[0],args[1]) return AST(Token('not_in')) def p_comma_separated_1(self, args): r' comma_separated ::= term ' ! trace('p_comma_separated_1 %s',args[0]) return AST(Token('comma_separated', [args[0]])) def p_comma_separated_2(self, args): r' comma_separated ::= comma_separated comma term' ! trace('p_comma_separated_2 %s %s',args[0], args[2]) l=args[0].attr[:] l.append(args[2]) *************** *** 318,332 **** def p_expr_2(self, args): r' expr ::= paren_open expr paren_close ' ! trace('paren expr_2:%s (%s-%s-%s)'%(args[1],args[1].left,args[1].type,args[1].right)) return AST(Token('paren', args[1])) def p_expr_3(self, args): r' expr ::= term ' ! trace('expr_3: %s'%args[0]) return args[0] def p_expr_4(self, args): r' expr ::= not_expr ' ! trace('expr_4: %s'%args[0]) return AST(args[0]) #return AST(Token('NOT', args[0].left)) --- 319,333 ---- def p_expr_2(self, args): r' expr ::= paren_open expr paren_close ' ! trace('paren expr_2:%s (%s-%s-%s)',args[1],args[1].left,args[1].type,args[1].right) return AST(Token('paren', args[1])) def p_expr_3(self, args): r' expr ::= term ' ! trace('expr_3: %s',args[0]) return args[0] def p_expr_4(self, args): r' expr ::= not_expr ' ! trace('expr_4: %s',args[0]) return AST(args[0]) #return AST(Token('NOT', args[0].left)) *************** *** 334,363 **** def p_term_1(self, args): r' term ::= number ' ! trace('term_1: %s'%args[0]) return AST(type=args[0]) def p_term_2(self, args): r' term ::= float ' ! trace('term_2: %s'%args[0]) return AST(type=args[0]) def p_term_3(self, args): r' term ::= string ' ! trace('term_3: %s'%args[0]) return AST(type=args[0]) def p_term_4(self, args): r' term ::= keypath ' ! trace('term_4: %s'%args[0]) return AST(type=args[0]) def p_term_5(self, args): r' term ::= nullValue ' ! trace('term_5: %s'%args[0]) return AST(type=args[0]) def p_not_expr(self, args): r' not_expr ::= not_operator qual ' ! trace('not_expr: %s/%s'%(args[0],args[1])) type=args[0] args[0].attr=args[1] --- 335,364 ---- def p_term_1(self, args): r' term ::= number ' ! trace('term_1: %s',args[0]) return AST(type=args[0]) def p_term_2(self, args): r' term ::= float ' ! trace('term_2: %s',args[0]) return AST(type=args[0]) def p_term_3(self, args): r' term ::= string ' ! trace('term_3: %s',args[0]) return AST(type=args[0]) def p_term_4(self, args): r' term ::= keypath ' ! trace('term_4: %s',args[0]) return AST(type=args[0]) def p_term_5(self, args): r' term ::= nullValue ' ! trace('term_5: %s',args[0]) return AST(type=args[0]) def p_not_expr(self, args): r' not_expr ::= not_operator qual ' ! trace('not_expr: %s/%s',args[0],args[1]) type=args[0] args[0].attr=args[1] *************** *** 379,383 **** comp_op ::= ilike ''' ! trace('comp_op: %s'%args[0]) return AST(type=args[0]) --- 380,384 ---- comp_op ::= ilike ''' ! trace('comp_op: %s',args[0]) return AST(type=args[0]) *************** *** 386,390 **** comp_op2 ::= in ''' ! trace('comp_op2: %s'%args[0]) return AST(type=args[0]) --- 387,391 ---- comp_op2 ::= in ''' ! trace('comp_op2: %s',args[0]) return AST(type=args[0]) *************** *** 394,403 **** operator ::= OR ''' ! trace('Operator: %s'%args[0]) return AST(type=args[0]) def p_not_operator(self, args): r' not_operator ::= NOT ' ! trace('Operator: %s'%args[0]) return AST(type=args[0]) --- 395,404 ---- operator ::= OR ''' ! trace('Operator: %s',args[0]) return AST(type=args[0]) def p_not_operator(self, args): r' not_operator ::= NOT ' ! trace('Operator: %s',args[0]) return AST(type=args[0]) *************** *** 436,447 **** node.exprType = 'nullValue' def n_paren(self, node): ! trace('N_PAREN ######%s %s'%(node.type,repr(node))) node.exprType = 'paren' def n_comma_separated(self, node): ! trace('COMMA_SEPARATED ######%s %s'%(node.type,repr(node))) node.exprType = 'comma_separated' def default(self, node): # this handles + and * nodes ! trace("TypeCheck default: node: %s %s"%(node,node.type)) #leftType = node.left.exprType #rightType = node.right.exprType --- 437,448 ---- node.exprType = 'nullValue' def n_paren(self, node): ! trace('N_PAREN ######%s %s',node.type,repr(node)) node.exprType = 'paren' def n_comma_separated(self, node): ! trace('COMMA_SEPARATED ######%s %s',node.type,repr(node)) node.exprType = 'comma_separated' def default(self, node): # this handles + and * nodes ! trace("TypeCheck default: node: %s %s",node,node.type) #leftType = node.left.exprType #rightType = node.right.exprType *************** *** 465,473 **** class Interpret(ASTTraversal): def __init__(self, ast): ! trace('Interpret.init() ast: %s'%ast) ASTTraversal.__init__(self, ast) self.postorder() self.value=ast.value ! trace('Interpret returns: %s'%self.value) def n_number(self, node): --- 466,474 ---- class Interpret(ASTTraversal): def __init__(self, ast): ! trace('Interpret.init() ast: %s',ast) ASTTraversal.__init__(self, ast) self.postorder() self.value=ast.value ! trace('Interpret returns: %s',self.value) def n_number(self, node): *************** *** 483,493 **** node.value = None def n_paren(self, node): ! trace('## Interpret_PAREN ###### %s'%repr(node)) _node=Interpret(node.attr) node.value = _node.value #node.attr = _node.attr def n_comma_separated(self, node): ! trace('## Interpret comma_separated ###### %s'%repr(node)) ! trace('## node.attr: %s'%node.attr) #_node=Interpret(node.attr) l=[] --- 484,494 ---- node.value = None def n_paren(self, node): ! trace('## Interpret_PAREN ###### %s',repr(node)) _node=Interpret(node.attr) node.value = _node.value #node.attr = _node.attr def n_comma_separated(self, node): ! trace('## Interpret comma_separated ###### %s',repr(node)) ! trace('## node.attr: %s',node.attr) #_node=Interpret(node.attr) l=[] *************** *** 498,507 **** def n_NOT(self, node): _node=Interpret(node.attr) ! trace('NOT node :%s'%_node.value) node.value = NotQualifier(_node.value) def default(self, node): left = right = None ! trace('default: node: %s'%node) try: left = node.left.value except: pass --- 499,508 ---- def n_NOT(self, node): _node=Interpret(node.attr) ! trace('NOT node :%s',_node.value) node.value = NotQualifier(_node.value) def default(self, node): left = right = None ! trace('default: node: %s',node) try: left = node.left.value except: pass *************** *** 513,523 **** #else: # node.value = left * right ! trace('left: %s type: %s right: %s'%(left, node.type, right)) if node.type == 'AND': node.value=AndQualifier(map(lambda o: o.value, node._kids)) ! trace("node.value: %s"%node.value) if node.type == 'OR': node.value=OrQualifier(map(lambda o: o.value, node._kids)) ! trace("node.value: %s"%node.value) if node.type in allQualifierOperators(): if node[1].type=='keypath': --- 514,524 ---- #else: # node.value = left * right ! trace('left: %s type: %s right: %s',left, node.type, right) if node.type == 'AND': node.value=AndQualifier(map(lambda o: o.value, node._kids)) ! trace("node.value: %s",node.value) if node.type == 'OR': node.value=OrQualifier(map(lambda o: o.value, node._kids)) ! trace("node.value: %s",node.value) if node.type in allQualifierOperators(): if node[1].type=='keypath': *************** *** 525,529 **** operatorForString(node.type), node[1].value) ! trace("node.value(keypath): %s"%node.value) if node[1].type in ('string', 'number', 'float', 'nullValue', 'comma_separated'): --- 526,530 ---- operatorForString(node.type), node[1].value) ! trace("node.value(keypath): %s",node.value) if node[1].type in ('string', 'number', 'float', 'nullValue', 'comma_separated'): *************** *** 531,535 **** operatorForString(node.type), node[1].value) ! trace("node.value(other): %s"%node.value) --- 532,536 ---- operatorForString(node.type), node[1].value) ! trace("node.value(other): %s",node.value) *************** *** 544,552 **** strIO=StringIO(anExpression) sc=scan(strIO) ! trace("\nEND scan: %s\n\n"%sc) _parse=parse(sc) ! trace("\nEND parse: %s\n\n"%_parse) sem=semantic(_parse) ! trace("\nEND sem: %s\n\n"%sem) result=generate(sem) # The following ensures that the result is of the correct type --- 545,553 ---- strIO=StringIO(anExpression) sc=scan(strIO) ! trace("\nEND scan: %s\n\n",sc) _parse=parse(sc) ! trace("\nEND parse: %s\n\n",_parse) sem=semantic(_parse) ! trace("\nEND sem: %s\n\n",sem) result=generate(sem) # The following ensures that the result is of the correct type *************** *** 571,579 **** strIO=StringIO(sys.argv[1]) sc=scan(strIO) ! trace("\nEND scan: %s\n\n"%sc) parse=parse(sc) ! trace("\nEND parse: %s\n\n"%parse) sem=semantic(parse) ! trace("\nEND sem: %s\n\n"%sem) print str(generate(sem)) #f.close() --- 572,580 ---- strIO=StringIO(sys.argv[1]) sc=scan(strIO) ! trace("\nEND scan: %s\n\n",sc) parse=parse(sc) ! trace("\nEND parse: %s\n\n",parse) sem=semantic(parse) ! trace("\nEND sem: %s\n\n",sem) print str(generate(sem)) #f.close() |
From: <sbi...@us...> - 2003-07-10 11:57:58
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv32057/tests Modified Files: test_EditingContext_Global.py test_Qualifier.py Log Message: Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', 'OR' and 'NOT' can now be written with lower-case characters. Index: test_EditingContext_Global.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_EditingContext_Global.py,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** test_EditingContext_Global.py 7 Jul 2003 14:57:14 -0000 1.26 --- test_EditingContext_Global.py 10 Jul 2003 11:57:55 -0000 1.27 *************** *** 708,712 **** self.failUnless('Dard' in objects_names) - def test_12_fetchingDoesNotUpdateSnapshot(self): "[EditingContext] Fetching should not update the Database's snapshot" --- 708,711 ---- *************** *** 913,916 **** --- 912,934 ---- self.failIf(objs) + def test_19_in_not_in_operators_in_qualifiers(self): + "[EditingContext] IN/NOT IN operators in qualifiers" + ec=EditingContext() + objects=ec.fetch('Writer', 'age in [24, 82]') + objects_names=[o.getLastName() for o in objects] + self.failUnless(len(objects)==2) + self.failUnless('Cleese' in objects_names) + self.failUnless('Dard' in objects_names) + + objects=ec.fetch('Writer', 'age not in [24, 82]') + objects_names=[o.getLastName() for o in objects] + self.failUnless(len(objects)==1) + self.failUnless('Rabelais' in objects_names) + + objects=ec.fetch('Writer', 'age in [24]') + objects_names=[o.getLastName() for o in objects] + self.failUnless(len(objects)==1) + self.failUnless('Cleese' in objects_names) + def test_999_customSQLQuery(self): "[EditingContext] customSQLQuery" *************** *** 961,965 **** sqlExpr.setStatement("delete from WRITER where id>3") channel.evaluateExpression(sqlExpr) - def reinitDB(): --- 979,982 ---- Index: test_Qualifier.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_Qualifier.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** test_Qualifier.py 31 May 2003 10:16:58 -0000 1.8 --- test_Qualifier.py 10 Jul 2003 11:57:55 -0000 1.9 *************** *** 308,312 **** self.failUnless(res and len(res)==1 and self.dummy in res) del Writer.getAGE ! # Build the test suite def test_suite(): --- 308,324 ---- self.failUnless(res and len(res)==1 and self.dummy in res) del Writer.getAGE ! ! def test_08_operator_in_not_in(self): ! "[Qualifier] IN and NOT IN operators" ! m_s=qualifierWithQualifierFormat('age IN [ 30, 70 ]') ! res=filteredArrayWithQualifier(self.authors, m_s) ! self.failUnless(len(res)==2 and self.jean in res and self.john in res) ! m_s=qualifierWithQualifierFormat('age IN [ 30 ]') # single item ! res=filteredArrayWithQualifier(self.authors, m_s) ! self.failUnless(len(res)==1 and self.john in res) ! m_s=qualifierWithQualifierFormat('age NOT IN [ 30, 70 ]') ! res=filteredArrayWithQualifier(self.authors, m_s) ! self.failUnless(len(res)==3 and self.douglas in res and self.victor in res and self.dummy in res) ! # Build the test suite def test_suite(): |
From: <sbi...@us...> - 2003-07-10 11:57:58
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide In directory sc8-pr-cvs1:/tmp/cvs-serv32057/doc/UserGuide Modified Files: ManipulatingGraphOfObjects.tex Log Message: Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', 'OR' and 'NOT' can now be written with lower-case characters. Index: ManipulatingGraphOfObjects.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide/ManipulatingGraphOfObjects.tex,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ManipulatingGraphOfObjects.tex 9 Jul 2003 12:00:24 -0000 1.11 --- ManipulatingGraphOfObjects.tex 10 Jul 2003 11:57:55 -0000 1.12 *************** *** 178,182 **** \end{verbatim} ! \subsection{Equality, comparisons\label{ec-fetch-operators}} When building your qualifiers, you can use the following operators: \begin{itemize} --- 178,182 ---- \end{verbatim} ! \subsection{Equality, comparisons, {\tt in} and {\tt not in}\label{ec-fetch-operators}} When building your qualifiers, you can use the following operators: \begin{itemize} *************** *** 187,190 **** --- 187,192 ---- \item \code{'>='}: greater than, or equal \item \code{'!='}: different than + \item \code{'in'}: check that the value is in a list (rvalue is a list, not a tuple) + \item \code{'not in'}: check that the value is in a list (rvalue is a list, not a tuple) \end{itemize} *************** *** 195,198 **** --- 197,208 ---- you'll get all the authors who are 80 years old or more. + \begin{notice}\code{in} and \code{not in} operators require that the right + value is expressed as a list, and not as a tuple (i.e. surrounded square + brackets '\code{[}' and '\code{]}'). For example: + \begin{verbatim} + objects=ec.fetch('Writer', qualifier='age in [82, 24]') + \end{verbatim} + \end{notice} + \subsection{Negating, Con- or disjoining qualifiers\label{ec-fetch-con-disjoin-and-negate}} *************** *** 221,227 **** \begin{notice} ! Operators \code{'AND'}, \code{'OR'} and \code{'NOT'} should be written with ! capitalized letters, while operators \code{'like'}, \code{ilike} and ! \code{'caseInsensitiveLike'} should be written as-is (exact typo.) \end{notice} --- 231,238 ---- \begin{notice} ! Operators \code{'AND'}, \code{'OR'}, \code{'NOT'}, \code{'IN'} and \code{'NOT ! IN'} can be written upper-case or lower-case, while operators \code{'like'}, ! \code{ilike} and \code{'caseInsensitiveLike'} should be written as-is (exact ! typo.) \end{notice} |
From: <sbi...@us...> - 2003-07-10 11:57:58
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv32057 Modified Files: CHANGES SQLExpression.py Qualifier.py QualifierParser.py Log Message: Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', 'OR' and 'NOT' can now be written with lower-case characters. Index: CHANGES =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v retrieving revision 1.121 retrieving revision 1.122 diff -C2 -d -r1.121 -r1.122 *** CHANGES 7 Jul 2003 14:57:13 -0000 1.121 --- CHANGES 10 Jul 2003 11:57:54 -0000 1.122 *************** *** 8,11 **** --- 8,13 ---- -------------------------------------------------------- + * Added operator 'in' and 'not in' for fetch qualifiers. Operators 'AND', + 'OR' and 'NOT' can now be written with lower-case characters. [Merged branch brch-0_9pre7-1-PyModel] Index: SQLExpression.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/SQLExpression.py,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** SQLExpression.py 17 Mar 2003 12:43:21 -0000 1.17 --- SQLExpression.py 10 Jul 2003 11:57:54 -0000 1.18 *************** *** 48,52 **** QualifierOperatorGreaterThanOrEqualTo, \ QualifierOperatorLike, \ ! QualifierOperatorCaseInsensitiveLike from Relationship import \ --- 48,53 ---- QualifierOperatorGreaterThanOrEqualTo, \ QualifierOperatorLike, \ ! QualifierOperatorCaseInsensitiveLike, \ ! QualifierOperatorIn, QualifierOperatorNotIn from Relationship import \ *************** *** 1198,1202 **** keyString=self.sqlStringForAttributeNamed(key) ! valueString=self.sqlStringForValue(value, key) if not caseInsensitive: --- 1199,1206 ---- keyString=self.sqlStringForAttributeNamed(key) ! if aQualifier.operator() in (QualifierOperatorIn, QualifierOperatorNotIn): ! valueString=self.sqlStringForInOperatorValue(value) ! else: ! valueString=self.sqlStringForValue(value, key) if not caseInsensitive: *************** *** 1205,1208 **** --- 1209,1226 ---- return self.sqlStringForCaseInsensitiveLike(keyString, valueString) + def sqlStringForInOperatorValue(self, aList): + """ + Returns the SQL string suitable for operator IN and NOT IN. + The returned string is a comma-separated list of the values in aList, + surrounded by brackets. + + Example: aList=[1], return '(1)' + aList=(1,2,4), return '(1, 2, 4)' + """ + if len(aList)==1: + return '(%s)'%aList[0] + else: + return str(tuple(aList)) + def sqlStringForNegatedQualifier(self, aQualifier): """ *************** *** 1342,1345 **** --- 1360,1369 ---- elif selectorIs(QualifierOperatorLike): return "LIKE" + + elif selectorIs(QualifierOperatorIn): + return "IN" + + elif selectorIs(QualifierOperatorNotIn): + return "NOT IN" raise ValueError, 'Unknown selector: %s'%repr(selector) Index: Qualifier.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Qualifier.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Qualifier.py 31 May 2003 10:16:57 -0000 1.6 --- Qualifier.py 10 Jul 2003 11:57:55 -0000 1.7 *************** *** 77,83 **** return re.match(__likeExprToRegexpString__(value2),str(value1),re.IGNORECASE) # Module def allQualifierOperators(): ! return ('==', '!=', '<', '<=', '>', '>=', 'like', 'caseInsensitiveLike', 'ilike') def filteredArrayWithQualifier(objects, qualifier): --- 77,91 ---- return re.match(__likeExprToRegexpString__(value2),str(value1),re.IGNORECASE) + def QualifierOperatorIn(value1, value2): + if type(value2)==type(''): + value2=eval(value2) + return value1 in value2 + + def QualifierOperatorNotIn(value1, value2): + return not QualifierOperatorIn(value1, value2) + # Module def allQualifierOperators(): ! return ('==', '!=', '<', '<=', '>', '>=', 'like', 'caseInsensitiveLike', 'ilike', 'in', 'not_in') def filteredArrayWithQualifier(objects, qualifier): *************** *** 97,100 **** --- 105,110 ---- if op == '>=': return QualifierOperatorGreaterThanOrEqualTo if op == 'like': return QualifierOperatorLike + if op == 'in': return QualifierOperatorIn + if op == 'not_in': return QualifierOperatorNotIn if op in ('caseInsensitiveLike', 'ilike'): return QualifierOperatorCaseInsensitiveLike *************** *** 131,134 **** --- 141,146 ---- if operator == QualifierOperatorLike: return 'like' if operator == QualifierOperatorCaseInsensitiveLike: return 'caseInsensitiveLike' + if operator == QualifierOperatorIn: return 'in' + if operator == QualifierOperatorNotIn: return 'not_in' raise ValueError Index: QualifierParser.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/QualifierParser.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** QualifierParser.py 31 May 2003 10:16:57 -0000 1.8 --- QualifierParser.py 10 Jul 2003 11:57:55 -0000 1.9 *************** *** 166,183 **** def t_operator(self, s): ! r' AND | OR ' trace('Token Operator: %s'%s) ! self.rv.append(Token(type=s)) def t_not_operator(self, s): ! r' NOT ' trace('Token NOT: %s'%s) ! self.rv.append(Token(type=s)) def t_comp_op(self, s): ! r' \+ | \* | == | >= | > | <= | < | \!= | like | caseInsensitiveLike | ilike' trace('Token COMP_OP: %s'%s) self.rv.append(Token(type=s)) def t_number(self, s): r' \d+ ' --- 166,188 ---- def t_operator(self, s): ! r' AND | and | OR | or ' trace('Token Operator: %s'%s) ! self.rv.append(Token(type=s.upper())) def t_not_operator(self, s): ! r' NOT | not ' trace('Token NOT: %s'%s) ! self.rv.append(Token(type=s.upper())) def t_comp_op(self, s): ! r' \+ | \* | == | >= | > | <= | < | \!= | like | caseInsensitiveLike | ilike ' trace('Token COMP_OP: %s'%s) self.rv.append(Token(type=s)) + def t_comp_op2(self, s): + r' in | IN ' + trace('Token COMP_OP2: %s'%s) + self.rv.append(Token(type=s.lower())) + def t_number(self, s): r' \d+ ' *************** *** 211,214 **** --- 216,234 ---- self.rv.append(t) + def t_square_bracket_open(self, s): + r' \[ ' + trace('Token square_bracket_open: %s'%s) + self.rv.append(Token(type='square_bracket_open')) + + def t_square_bracket_close(self, s): + r' \] ' + trace('Token square_bracket_close: %s'%s) + self.rv.append(Token(type='square_bracket_close')) + + def t_comma(self, s): + r' , ' + trace('Token comma: %s'%s) + self.rv.append(Token(type='comma')) + #def t_simplekeypath(self, s): # r' \c+ ' *************** *** 265,272 **** right=args[2]) def p_expr_2(self, args): r' expr ::= paren_open expr paren_close ' trace('paren expr_2:%s (%s-%s-%s)'%(args[1],args[1].left,args[1].type,args[1].right)) - #inside=AST(args[0]) return AST(Token('paren', args[1])) --- 285,322 ---- right=args[2]) + def p_expr_in(self, args): + r' expr ::= expr comp_op2 square_bracket_open comma_separated square_bracket_close ' + trace('p_expr_1a %s/%s/%s/%s/%s'%(args[0],args[1],args[2],args[3],args[4])) + return AST(type=args[1], + left=args[0], + right=args[3]) + + def p_expr_not_in(self, args): + r' expr ::= expr not_in square_bracket_open comma_separated square_bracket_close ' + trace('p_expr_1a %s/%s/%s/%s/%s'%(args[0],args[1],args[2],args[3],args[4])) + return AST(type=args[1], + left=args[0], + right=args[3]) + + def p_not_in(self, args): + r' not_in ::= not_operator comp_op2 ' + trace('p_not_in %s %s'%(args[0],args[1])) + return AST(Token('not_in')) + + def p_comma_separated_1(self, args): + r' comma_separated ::= term ' + trace('p_comma_separated_1 %s'%args[0]) + return AST(Token('comma_separated', [args[0]])) + + def p_comma_separated_2(self, args): + r' comma_separated ::= comma_separated comma term' + trace('p_comma_separated_2 %s %s'%(args[0], args[2])) + l=args[0].attr[:] + l.append(args[2]) + return AST(Token('comma_separated', l)) + def p_expr_2(self, args): r' expr ::= paren_open expr paren_close ' trace('paren expr_2:%s (%s-%s-%s)'%(args[1],args[1].left,args[1].type,args[1].right)) return AST(Token('paren', args[1])) *************** *** 332,335 **** --- 382,392 ---- return AST(type=args[0]) + def p_comp_op2(self, args): + ''' + comp_op2 ::= in + ''' + trace('comp_op2: %s'%args[0]) + return AST(type=args[0]) + def p_operator(self, args): ''' *************** *** 381,387 **** trace('N_PAREN ######%s %s'%(node.type,repr(node))) node.exprType = 'paren' def default(self, node): # this handles + and * nodes ! trace("node: %s %s"%(node,node.type)) #leftType = node.left.exprType #rightType = node.right.exprType --- 438,447 ---- trace('N_PAREN ######%s %s'%(node.type,repr(node))) node.exprType = 'paren' + def n_comma_separated(self, node): + trace('COMMA_SEPARATED ######%s %s'%(node.type,repr(node))) + node.exprType = 'comma_separated' def default(self, node): # this handles + and * nodes ! trace("TypeCheck default: node: %s %s"%(node,node.type)) #leftType = node.left.exprType #rightType = node.right.exprType *************** *** 405,408 **** --- 465,469 ---- class Interpret(ASTTraversal): def __init__(self, ast): + trace('Interpret.init() ast: %s'%ast) ASTTraversal.__init__(self, ast) self.postorder() *************** *** 426,440 **** node.value = _node.value #node.attr = _node.attr ! def n_NOT(self, node): _node=Interpret(node.attr) trace('NOT node :%s'%_node.value) node.value = NotQualifier(_node.value) ! def default(self, node): left = right = None ! try: ! left = node.left.value ! right = node.right.value except: pass # This is the original calculator! --- 487,510 ---- node.value = _node.value #node.attr = _node.attr ! def n_comma_separated(self, node): ! trace('## Interpret comma_separated ###### %s'%repr(node)) ! trace('## node.attr: %s'%node.attr) ! #_node=Interpret(node.attr) ! l=[] ! for attr in node.attr: ! l.append(Interpret(attr).value) ! #node.value = list(node.attr) ! node.value = l def n_NOT(self, node): _node=Interpret(node.attr) trace('NOT node :%s'%_node.value) node.value = NotQualifier(_node.value) ! def default(self, node): left = right = None ! trace('default: node: %s'%node) ! try: left = node.left.value ! except: pass ! try: right = node.right.value except: pass # This is the original calculator! *************** *** 455,465 **** operatorForString(node.type), node[1].value) ! trace("node.value: %s"%node.value) ! if node[1].type in ('string', 'number', 'float', 'nullValue'): node.value=KeyValueQualifier(node[0].value, operatorForString(node.type), node[1].value) ! trace("node.value: %s"%node.value) ! --- 525,535 ---- operatorForString(node.type), node[1].value) ! trace("node.value(keypath): %s"%node.value) ! if node[1].type in ('string', 'number', 'float', 'nullValue', ! 'comma_separated'): node.value=KeyValueQualifier(node[0].value, operatorForString(node.type), node[1].value) ! trace("node.value(other): %s"%node.value) |
From: <sbi...@us...> - 2003-07-09 12:00:26
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide In directory sc8-pr-cvs1:/tmp/cvs-serv14207/doc/UserGuide Modified Files: ManipulatingGraphOfObjects.tex Log Message: Minor correction Index: ManipulatingGraphOfObjects.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide/ManipulatingGraphOfObjects.tex,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ManipulatingGraphOfObjects.tex 4 Jul 2003 17:06:52 -0000 1.10 --- ManipulatingGraphOfObjects.tex 9 Jul 2003 12:00:24 -0000 1.11 *************** *** 308,313 **** \end{verbatim} ! (This model is in fact the model \code{StoreEmployees} you'll find in the ! unittests shipped with the framework) \begin{itemize} --- 308,313 ---- \end{verbatim} ! (This model is in fact a subset of the model \code{StoreEmployees} you'll find ! in the unittests shipped with the framework) \begin{itemize} |
From: <sbi...@us...> - 2003-07-09 11:45:04
|
Update of /cvsroot/modeling/ProjectModeling In directory sc8-pr-cvs1:/tmp/cvs-serv12498 Modified Files: MANIFEST.in Log Message: Removed files .xml2 and .xml3 Index: MANIFEST.in =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/MANIFEST.in,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** MANIFEST.in 26 May 2003 16:17:51 -0000 1.8 --- MANIFEST.in 9 Jul 2003 11:45:01 -0000 1.9 *************** *** 20,25 **** recursive-include Modeling/tests/xmlmodels *.txt *.xml - include Modeling/tests/xmlmodels/model_StoreEmployees.xml2 - include Modeling/tests/xmlmodels/model_StoreEmployees.xml3 include Modeling/DatabaseAdaptors/COPYING --- 20,23 ---- |
From: <sbi...@us...> - 2003-07-09 11:42:44
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests In directory sc8-pr-cvs1:/tmp/cvs-serv12293/Modeling/tests Modified Files: test_generate_python_code.sh Log Message: Refactored to test pymodels as well; now also handles option -v Index: test_generate_python_code.sh =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/test_generate_python_code.sh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_generate_python_code.sh 26 May 2003 15:44:49 -0000 1.2 --- test_generate_python_code.sh 9 Jul 2003 11:42:41 -0000 1.3 *************** *** 6,24 **** PYTHON=/usr/local/bin/python - function test_AuthorBooks() { - $PYTHON ./test_EditingContext_Global.py > /dev/null 2>&1 - } - - function test_StoreEmployees() { - $PYTHON ./test_EditingContext_Global_Inheritance.py > /dev/null 2>&1 - } - tests_dir=`pwd` mdl_dir=`dirname $tests_dir` export PYTHONPATH=`dirname $mdl_dir`:$PYTHONPATH ##-------- ## You should not need to modify anything below this line ##-------- function check_success() { if [ $? -ne 0 ]; then --- 6,53 ---- PYTHON=/usr/local/bin/python tests_dir=`pwd` mdl_dir=`dirname $tests_dir` export PYTHONPATH=`dirname $mdl_dir`:$PYTHONPATH + models_AuthorBooks=`echo \ + "testPackages/AuthorBooks.ori/model_AuthorBooks.xml" \ + "testPackages/AuthorBooks.ori/pymodel_AuthorBooks.py"` + + models_StoreEmployees12=`echo "xmlmodels/model_StoreEmployees.xml xmlmodels/model_StoreEmployees2.xml testPackages/StoreEmployees.ori/pymodel_StoreEmployees.py xmlmodels/pymodel_StoreEmployees2.py"` + + models_StoreEmployees3=`echo "xmlmodels/model_StoreEmployees3.xml xmlmodels/pymodel_StoreEmployees3.py"` + ##-------- ## You should not need to modify anything below this line ##-------- + argc=$# + argv=$* + + function execute () { + if [ $argc -ge 1 ] && [ ${argv[0]} == "-v" ]; then + $* + else + $* > /dev/null 2>&1 + fi + } + + function test_AuthorBooks() { + execute $PYTHON ./test_EditingContext_Global.py + } + function test_StoreEmployees() { + execute $PYTHON ./test_EditingContext_Global_Inheritance.py + } + function fix_StoreEmployees() { + if [ ! -e testPackages/StoreEmployees/Executive.py ]; then + echo 'from Employees import Executive' > testPackages/StoreEmployees/Executive.py + fi + if [ ! -e testPackages/StoreEmployees/SalesClerk.py ]; then + echo 'from Employees import SalesClerk' > testPackages/StoreEmployees/SalesClerk.py + fi + if [ ! -e testPackages/StoreEmployees/Employee.py ]; then + echo 'from Employees import Employee' > testPackages/StoreEmployees/Employee.py + fi + } + function check_success() { if [ $? -ne 0 ]; then *************** *** 35,41 **** fi } - function generate() { ! $PYTHON $GENERATE $* > /dev/null 2>&1 } --- 64,69 ---- fi } function generate() { ! execute $PYTHON $GENERATE $* } *************** *** 44,115 **** cp -Rp testPackages/StoreEmployees testPackages/StoreEmployees.ori ! ######## AuthorBooks / -B ! ! $RMDIR testPackages/AuthorBooks ; ! generate -B ./xmlmodels/model_AuthorBooks.xml testPackages/ ! test_AuthorBooks ! check_success "AuthorBooks / -B" ! ! ######## AuthorBooks / -C ! ! $RMDIR testPackages/AuthorBooks ! generate -C ./xmlmodels/model_AuthorBooks.xml testPackages/ ! test_AuthorBooks ! check_success "AuthorBooks / -C" ! ! ######## StoreEmployees / -B / xml ! ! $RMDIR testPackages/StoreEmployees ! generate -B ./xmlmodels/model_StoreEmployees.xml testPackages/ ! test_StoreEmployees ! check_success "StoreEmployees / -B / xml" ! ! ######## StoreEmployees / -C / xml ! ! $RMDIR testPackages/StoreEmployees ! generate -C ./xmlmodels/model_StoreEmployees.xml testPackages/ ! test_StoreEmployees ! check_success "StoreEmployees / -C / xml" ! ! ######## StoreEmployees / -B / xml 2 (Executive&SalesClerk in module Employees) ! ! $RMDIR testPackages/StoreEmployees ! generate -B ./xmlmodels/model_StoreEmployees.xml2 testPackages/ ! echo 'from Employees import Executive' > testPackages/StoreEmployees/Executive.py ! echo 'from Employees import SalesClerk' > testPackages/StoreEmployees/SalesClerk.py ! test_StoreEmployees ! check_success "StoreEmployees / -B / xml2" ! ! # less StoreEmployees/MDL/Employees.py ! ######## StoreEmployees / -C / xml 2 - $RMDIR testPackages/StoreEmployees - generate -C ./xmlmodels/model_StoreEmployees.xml2 testPackages/ - echo 'from Employees import Executive' > testPackages/StoreEmployees/Executive.py - echo 'from Employees import SalesClerk' > testPackages/StoreEmployees/SalesClerk.py - test_StoreEmployees - check_success "StoreEmployees / -C / xml2" ! ######## StoreEmployees / -C / xml 3 ######## (Executive+SalesClerk+Employee in module Employees) ! $RMDIR testPackages/StoreEmployees ! generate -C ./xmlmodels/model_StoreEmployees.xml3 testPackages/ ! echo 'from Employees import Executive' > testPackages/StoreEmployees/Executive.py ! echo 'from Employees import SalesClerk' > testPackages/StoreEmployees/SalesClerk.py ! echo 'from Employees import Employee' > testPackages/StoreEmployees/Employee.py ! ! test_StoreEmployees ! check_success "StoreEmployees / -C / xml3" ! ! ######## StoreEmployees / -B / xml 3 ! ######## Should fail!!! ! $RMDIR testPackages/StoreEmployees ! generate -B ./xmlmodels/model_StoreEmployees.xml3 testPackages/ ! check_failure "StoreEmployees / -B / xml3" ! ! # less StoreEmployees/MDL/Employees.py ## Restore original directories --- 72,127 ---- cp -Rp testPackages/StoreEmployees testPackages/StoreEmployees.ori ! ######## AuthorBooks ! for model in $models_AuthorBooks; do ! ## -B ! $RMDIR testPackages/AuthorBooks ; ! generate -B $model testPackages/ ! test_AuthorBooks ! check_success "AuthorBooks / -B w/ $model" ! ! ## -C ! $RMDIR testPackages/AuthorBooks ! generate -C $model testPackages/ ! test_AuthorBooks ! check_success "AuthorBooks / -C w/ $model" ! done + ######## StoreEmployees / -B / models 1 & 2 + for model in $models_StoreEmployees12; do + ## -B + + $RMDIR testPackages/StoreEmployees + generate -B $model testPackages/ + fix_StoreEmployees + test_StoreEmployees + check_success "StoreEmployees / -B w/ $model" + + ## -C / xml + + $RMDIR testPackages/StoreEmployees + generate -C $model testPackages/ + fix_StoreEmployees + test_StoreEmployees + check_success "StoreEmployees / -C w/ $model" + done ! ######## StoreEmployees / -C / model 3 ######## (Executive+SalesClerk+Employee in module Employees) ! for model in $models_StoreEmployees3; do ! ## -C ! $RMDIR testPackages/StoreEmployees ! generate -C $model testPackages/ ! fix_StoreEmployees ! test_StoreEmployees ! check_success "StoreEmployees / -C w/ $model" + ## -B / xml 3 : Should fail!!! + $RMDIR testPackages/StoreEmployees + generate -B $model testPackages/ + fix_StoreEmployees + check_failure "StoreEmployees / -B w/ $model" + done ## Restore original directories |
From: <sbi...@us...> - 2003-07-09 11:41:18
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/AuthorBooks In directory sc8-pr-cvs1:/tmp/cvs-serv12148/Modeling/tests/testPackages/AuthorBooks Modified Files: pymodel_AuthorBooks.py Log Message: Fixed: model's and entities' names were incorrect Index: pymodel_AuthorBooks.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/AuthorBooks/pymodel_AuthorBooks.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** pymodel_AuthorBooks.py 7 Jul 2003 14:57:14 -0000 1.2 --- pymodel_AuthorBooks.py 9 Jul 2003 11:41:15 -0000 1.3 *************** *** 26,30 **** _connDict = {'database': 'AUTHOR_BOOKS'} ! model = Model('_AuthorBooks',adaptorName='Postgresql', connDict=_connDict) model.doc = ' ... ' --- 26,30 ---- _connDict = {'database': 'AUTHOR_BOOKS'} ! model = Model('AuthorBooks',adaptorName='Postgresql', connDict=_connDict) model.doc = ' ... ' *************** *** 32,41 **** model.entities = [ # ! Entity('_Book', properties=[ APrimaryKey('id', isClassProperty=1), AString('title', isRequired=1), AFloat('price'), ], ), ! Entity('_Writer', properties=[ AString('lastName',isRequired=1, width=30, displayLabel='Last Name', ), --- 32,41 ---- model.entities = [ # ! Entity('Book', properties=[ APrimaryKey('id', isClassProperty=1), AString('title', isRequired=1), AFloat('price'), ], ), ! Entity('Writer', properties=[ AString('lastName',isRequired=1, width=30, displayLabel='Last Name', ), *************** *** 50,58 **** #--- model.associations=[ ! Association('_Book', '_Writer', relations=['author', 'books'], delete=['nullify', 'cascade'], keys=['FK_Writer_Id', 'id']), ! Association('_Writer', '_Writer', relations=['pygmalion', None], delete=['nullify', None], --- 50,58 ---- #--- model.associations=[ ! Association('Book', 'Writer', relations=['author', 'books'], delete=['nullify', 'cascade'], keys=['FK_Writer_Id', 'id']), ! Association('Writer', 'Writer', relations=['pygmalion', None], delete=['nullify', None], |
From: <sbi...@us...> - 2003-07-09 11:40:36
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks In directory sc8-pr-cvs1:/tmp/cvs-serv12073/Modeling/ModelMasons/Python_bricks Modified Files: init.tmpl Log Message: Fixed template that cheetah couldn't correctly compile Index: init.tmpl =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks/init.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** init.tmpl 7 Jul 2003 14:57:14 -0000 1.7 --- init.tmpl 9 Jul 2003 11:40:33 -0000 1.8 *************** *** 8,16 **** import os mydir = os.path.abspath(os.path.dirname(__file__)) ! model=Model.searchModel('$(model_name)', mydir, verbose=0) if not model: import warnings ! warnings.warn("Couldn't load model '$(model_name)'") else: ModelSet.defaultModelSet().addModel(model) --- 8,16 ---- import os mydir = os.path.abspath(os.path.dirname(__file__)) ! model=Model.searchModel("$(model_name)", mydir, verbose=0) if not model: import warnings ! warnings.warn("Couldn't load model $(model_name)") else: ModelSet.defaultModelSet().addModel(model) |
From: <sbi...@us...> - 2003-07-08 17:32:25
|
Update of /cvsroot/modeling/ProjectModeling/Modeling In directory sc8-pr-cvs1:/tmp/cvs-serv18020 Modified Files: Model.py Log Message: searchModel should catch ImportError, possibly raised by loadModel() Index: Model.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Model.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Model.py 7 Jul 2003 14:57:13 -0000 1.6 --- Model.py 8 Jul 2003 17:32:22 -0000 1.7 *************** *** 231,235 **** mylog('Trying %s'%file) model=loadModel(file) ! except (IOError, ValueError): import cStringIO, traceback exc=cStringIO.StringIO() --- 231,235 ---- mylog('Trying %s'%file) model=loadModel(file) ! except (IOError, ValueError, ImportError): import cStringIO, traceback exc=cStringIO.StringIO() |
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/xmlmodels In directory sc8-pr-cvs1:/tmp/cvs-serv3358/xmlmodels Added Files: model_StoreEmployees2.xml model_StoreEmployees3.xml Removed Files: model_StoreEmployees.xml2 model_StoreEmployees.xml3 Log Message: Renamed model.xml2/3 to model2/3.xml --- NEW FILE: model_StoreEmployees2.xml --- <?xml version='1.0' encoding='iso-8859-1'?> <model name='StoreEmployees' packageName='StoreEmployees' adaptorName='' connectionDictionary="{'database': 'STORE_EMPLOYEES', 'user': '', 'password': '', 'host': ''}"> <entity isReadOnly='0' isAbstract='0' name='Store' parentEntity='' moduleName='Store' className='Store' typeName='' externalName='STORE'> <primaryKey attributeName='id'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='30' columnName='CORPORATE_NAME' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' name='corporateName' scale='0' type='string' displayLabel=''/> <relation deleteRule='1' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Employee' name='employees' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkStoreId'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Employee' parentEntity='' moduleName='Employee' className='Employee' typeName='' externalName='EMPLOYEE'> <primaryKey attributeName='id'/> <attributesUsedForLocking attributeName='lastName'/> <attributesUsedForLocking attributeName='firstName'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='50' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_STORE_ID' isRequired='0' precision='0' defaultValue='None' externalType='integer' name='fkStoreId' scale='0' type='int' displayLabel=''/> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Address' name='toAddresses' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> </relation> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Store' name='toStore' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Address' parentEntity='' moduleName='Address' className='Address' typeName='' externalName='ADDRESS'> <primaryKey attributeName='id'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='80' columnName='STREET' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='street' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='10' columnName='ZIP_CODE' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='zipCode' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='30' columnName='TOWN' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='town' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_EMPLOYEE_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='fkEmployeeId' scale='0' type='int' displayLabel=''/> <relation deleteRule='1' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Employee' name='toEmployee' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkEmployeeId' destinationAttribute='id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='SalesClerk' parentEntity='Employee' moduleName='Employees' className='SalesClerk' typeName='' externalName='SALES_CLERK'> <primaryKey attributeName='id'/> <attributesUsedForLocking attributeName='lastName'/> <attributesUsedForLocking attributeName='firstName'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='50' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_STORE_ID' isRequired='0' precision='0' defaultValue='' externalType='integer' name='fkStoreId' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='STORE_AREA' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='storeArea' scale='0' type='string' displayLabel=''/> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Address' name='toAddresses' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> </relation> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Store' name='toStore' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Executive' parentEntity='Employee' moduleName='Employees' className='Executive' typeName='' externalName='EXECUTIVE'> <primaryKey attributeName='id'/> <attributesUsedForLocking attributeName='lastName'/> <attributesUsedForLocking attributeName='firstName'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='50' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_STORE_ID' isRequired='0' precision='0' defaultValue='' externalType='integer' name='fkStoreId' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='5' columnName='OFFICE_LOCATION' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='officeLocation' scale='0' type='string' displayLabel=''/> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Address' name='toAddresses' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> </relation> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Store' name='toStore' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Mark' name='marks' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='FK_Executive_id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Mark' parentEntity='' moduleName='Mark' className='Mark' typeName='' externalName='MARK'> <primaryKey attributeName='id'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='0' columnName='MONTH' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='month' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='0' columnName='MARK' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='mark' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_EXECUTIVE_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='FK_Executive_id' scale='0' type='int' displayLabel=''/> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Executive' name='executive' displayLabel='' joinSemantic='0'> <join sourceAttribute='FK_Executive_id' destinationAttribute='id'/> </relation> </entity> </model> --- NEW FILE: model_StoreEmployees3.xml --- <?xml version='1.0' encoding='iso-8859-1'?> <model name='StoreEmployees' packageName='StoreEmployees' adaptorName='' connectionDictionary="{'database': 'STORE_EMPLOYEES', 'user': '', 'password': '', 'host': ''}"> <entity isReadOnly='0' isAbstract='0' name='Store' parentEntity='' moduleName='Store' className='Store' typeName='' externalName='STORE'> <primaryKey attributeName='id'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='30' columnName='CORPORATE_NAME' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' name='corporateName' scale='0' type='string' displayLabel=''/> <relation deleteRule='1' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Employee' name='employees' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkStoreId'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Employee' parentEntity='' moduleName='Employees' className='Employee' typeName='' externalName='EMPLOYEE'> <primaryKey attributeName='id'/> <attributesUsedForLocking attributeName='lastName'/> <attributesUsedForLocking attributeName='firstName'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='50' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_STORE_ID' isRequired='0' precision='0' defaultValue='None' externalType='integer' name='fkStoreId' scale='0' type='int' displayLabel=''/> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Address' name='toAddresses' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> </relation> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Store' name='toStore' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Address' parentEntity='' moduleName='Address' className='Address' typeName='' externalName='ADDRESS'> <primaryKey attributeName='id'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='80' columnName='STREET' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='street' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='10' columnName='ZIP_CODE' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='zipCode' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='30' columnName='TOWN' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='town' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_EMPLOYEE_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='fkEmployeeId' scale='0' type='int' displayLabel=''/> <relation deleteRule='1' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Employee' name='toEmployee' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkEmployeeId' destinationAttribute='id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='SalesClerk' parentEntity='Employee' moduleName='Employees' className='SalesClerk' typeName='' externalName='SALES_CLERK'> <primaryKey attributeName='id'/> <attributesUsedForLocking attributeName='lastName'/> <attributesUsedForLocking attributeName='firstName'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='50' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_STORE_ID' isRequired='0' precision='0' defaultValue='' externalType='integer' name='fkStoreId' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='STORE_AREA' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='storeArea' scale='0' type='string' displayLabel=''/> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Address' name='toAddresses' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> </relation> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Store' name='toStore' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Executive' parentEntity='Employee' moduleName='Employees' className='Executive' typeName='' externalName='EXECUTIVE'> <primaryKey attributeName='id'/> <attributesUsedForLocking attributeName='lastName'/> <attributesUsedForLocking attributeName='firstName'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='50' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='1' width='20' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_STORE_ID' isRequired='0' precision='0' defaultValue='' externalType='integer' name='fkStoreId' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='5' columnName='OFFICE_LOCATION' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='officeLocation' scale='0' type='string' displayLabel=''/> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Address' name='toAddresses' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='fkEmployeeId'/> </relation> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Store' name='toStore' displayLabel='' joinSemantic='0'> <join sourceAttribute='fkStoreId' destinationAttribute='id'/> </relation> <relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Mark' name='marks' displayLabel='' joinSemantic='0'> <join sourceAttribute='id' destinationAttribute='FK_Executive_id'/> </relation> </entity> <entity isReadOnly='0' isAbstract='0' name='Mark' parentEntity='' moduleName='Mark' className='Mark' typeName='' externalName='MARK'> <primaryKey attributeName='id'/> <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='0' columnName='MONTH' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='month' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='1' width='0' columnName='MARK' isRequired='1' precision='0' defaultValue='None' externalType='INTEGER' name='mark' scale='0' type='int' displayLabel=''/> <attribute isClassProperty='0' width='0' columnName='FK_EXECUTIVE_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='FK_Executive_id' scale='0' type='int' displayLabel=''/> <relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Executive' name='executive' displayLabel='' joinSemantic='0'> <join sourceAttribute='FK_Executive_id' destinationAttribute='id'/> </relation> </entity> </model> --- model_StoreEmployees.xml2 DELETED --- --- model_StoreEmployees.xml3 DELETED --- |
From: <sbi...@us...> - 2003-07-08 10:09:57
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage In directory sc8-pr-cvs1:/tmp/cvs-serv10175/doc/HomePage Modified Files: contributors.tex Log Message: Added credits for Savoir-faire Linux, which invests some time on supporting open-source projects, including this framework Index: contributors.tex =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/HomePage/contributors.tex,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** contributors.tex 6 Jul 2003 12:00:10 -0000 1.2 --- contributors.tex 8 Jul 2003 10:09:55 -0000 1.3 *************** *** 13,17 **** patches and useful critics ;) \begin{itemize} ! \item Yannick Gingras \item Ernesto Revilla \item Mario Ruggier --- 13,17 ---- patches and useful critics ;) \begin{itemize} ! \item Yannick Gingras from \begin{rawhtml}<a href="http://www.savoirfairelinux.com/">Savoir-faire Linux</A>\end{rawhtml} \item Ernesto Revilla \item Mario Ruggier |
From: <sbi...@us...> - 2003-07-07 14:57:18
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/xmlmodels In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/tests/xmlmodels Added Files: pymodel_StoreEmployees2.py pymodel_StoreEmployees3.py Log Message: Merged branch brch-0_9pre7-1-PyModel. Introducing: ability to express models in plain python rather than in xml files. See CHANGES for details. |
From: <sbi...@us...> - 2003-07-07 14:57:18
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/tests/testPackages/StoreEmployees Modified Files: __init__.py Added Files: pymodel_StoreEmployees.py Log Message: Merged branch brch-0_9pre7-1-PyModel. Introducing: ability to express models in plain python rather than in xml files. See CHANGES for details. Index: __init__.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/__init__.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** __init__.py 21 Aug 2002 18:40:17 -0000 1.2 --- __init__.py 7 Jul 2003 14:57:15 -0000 1.3 *************** *** 1,36 **** # Load the model ! from Modeling import ModelSet ! import os, warnings, StringIO, traceback ! from model_StoreEmployees import model_src ! try: ! if ModelSet.defaultModelSet().modelNamed("StoreEmployees") is None: ! ModelSet.defaultModelSet().addModelFromXML({'string': model_src}) ! model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') ! except: ! exc=StringIO.StringIO() ! traceback.print_exc(file=exc) ! warnings.warn("Couldn't load model 'model_StoreEmployees.xml'\nReason:\n%s"%exc.getvalue()) ! del exc ! del os, warnings, StringIO, traceback, model_src ! # Or, alternatively: use the xml file (ok for dev. mode, not for install w/ ! # distutils) ! # ! # from Modeling import ModelSet ! # import os, warnings, StringIO, traceback ! # try: ! # if ModelSet.defaultModelSet().modelNamed("StoreEmployees") is None: ! # from os import getcwd, path ! # mydir = os.path.abspath(os.path.dirname(__file__)) ! # xmlmodelPath=path.join(mydir,'model_StoreEmployees.xml') ! # ModelSet.defaultModelSet().addModelFromXML({'file': xmlmodelPath}) ! # model=ModelSet.defaultModelSet().modelNamed('StoreEmployees') ! # except: ! # exc=StringIO.StringIO() ! # traceback.print_exc(file=exc) ! # warnings.warn("Couldn't load model 'model_StoreEmployees.xml'\nReason:\n%s"%exc.getvalue()) ! # del exc ! # ! # del os, warnings, StringIO, traceback --- 1,14 ---- # Load the model ! from Modeling import ModelSet, Model ! if ModelSet.defaultModelSet().modelNamed("StoreEmployees") is None: ! import os ! mydir = os.path.abspath(os.path.dirname(__file__)) ! model=Model.searchModel('StoreEmployees', mydir, verbose=0) ! if not model: ! import warnings ! warnings.warn("Couldn't load model 'StoreEmployees'") ! else: ! ModelSet.defaultModelSet().addModel(model) |
From: <sbi...@us...> - 2003-07-07 14:57:18
|
Update of /cvsroot/modeling/ZModeling/ZModelizationTool/dtml In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ZModeling/ZModelizationTool/dtml Modified Files: entity_properties.dtml simpleRelationship_properties.dtml Log Message: Merged branch brch-0_9pre7-1-PyModel. Introducing: ability to express models in plain python rather than in xml files. See CHANGES for details. Index: entity_properties.dtml =================================================================== RCS file: /cvsroot/modeling/ZModeling/ZModelizationTool/dtml/entity_properties.dtml,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** entity_properties.dtml 22 Apr 2003 09:35:19 -0000 1.5 --- entity_properties.dtml 7 Jul 2003 14:57:15 -0000 1.6 *************** *** 252,258 **** </td> <td><i> ! <dtml-if "deleteRule()==0">NULLIFY</dtml-if> ! <dtml-if "deleteRule()==1">DENY</dtml-if> ! <dtml-if "deleteRule()==2">CASCADE</dtml-if> </i></td> <td> --- 252,256 ---- </td> <td><i> ! <dtml-var deleteRule> </i></td> <td> Index: simpleRelationship_properties.dtml =================================================================== RCS file: /cvsroot/modeling/ZModeling/ZModelizationTool/dtml/simpleRelationship_properties.dtml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** simpleRelationship_properties.dtml 22 Apr 2003 09:35:23 -0000 1.3 --- simpleRelationship_properties.dtml 7 Jul 2003 14:57:15 -0000 1.4 *************** *** 113,122 **** <th valign=top>Delete rule</th> <td><div class="form-element"> ! <dtml-if "deleteRule()==0"> <INPUT TYPE=RADIO NAME="deleteRule:int" value="0" CHECKED> <dtml-else><INPUT TYPE=RADIO NAME="deleteRule:int" value="0"> </dtml-if> DELETE_NULLIFY<br> ! <dtml-if "deleteRule()==1"> <INPUT TYPE=RADIO NAME="deleteRule:int" value="1" CHECKED> <dtml-else> --- 113,122 ---- <th valign=top>Delete rule</th> <td><div class="form-element"> ! <dtml-if "deleteRule()=='nullify'"> <INPUT TYPE=RADIO NAME="deleteRule:int" value="0" CHECKED> <dtml-else><INPUT TYPE=RADIO NAME="deleteRule:int" value="0"> </dtml-if> DELETE_NULLIFY<br> ! <dtml-if "deleteRule()=='deny'"> <INPUT TYPE=RADIO NAME="deleteRule:int" value="1" CHECKED> <dtml-else> *************** *** 124,128 **** </dtml-if> DELETE_DENY<br> ! <dtml-if "deleteRule()==2"> <INPUT TYPE=RADIO NAME="deleteRule:int" value="2" CHECKED> <dtml-else> --- 124,128 ---- </dtml-if> DELETE_DENY<br> ! <dtml-if "deleteRule()=='cascade'"> <INPUT TYPE=RADIO NAME="deleteRule:int" value="2" CHECKED> <dtml-else> |
From: <sbi...@us...> - 2003-07-07 14:57:17
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/AuthorBooks In directory sc8-pr-cvs1:/tmp/cvs-serv7471/ProjectModeling/Modeling/tests/testPackages/AuthorBooks Added Files: pymodel_AuthorBooks.py Log Message: Merged branch brch-0_9pre7-1-PyModel. Introducing: ability to express models in plain python rather than in xml files. See CHANGES for details. |