[Modeling-cvs] ProjectModeling/Modeling/tests/testPackages/StoreEmployees pymodel_StoreEmployees.py,
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-06-17 17:04:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees In directory sc8-pr-cvs1:/tmp/cvs-serv5757/tests/testPackages/StoreEmployees Modified Files: Tag: brch-0_9pre7-1-PyModel pymodel_StoreEmployees.py Log Message: Modified so that Model.searchModel can find & load the PyModel Index: pymodel_StoreEmployees.py =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/Attic/pymodel_StoreEmployees.py,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -C2 -d -r1.1.2.3 -r1.1.2.4 *** pymodel_StoreEmployees.py 19 May 2003 10:37:23 -0000 1.1.2.3 --- pymodel_StoreEmployees.py 17 Jun 2003 17:04:24 -0000 1.1.2.4 *************** *** 18,25 **** Association.defaults['delete']=['nullify', 'nullify'] - # Note that Relation.attNameFromRel is a callable, that calculates the att - # name from the indicated pieces (where count to distinguish between multiple - # relations between same source and target - Entity.defaults['properties'] = [ APrimaryKey('id', isClassProperty=0, isRequired=1, doc='Primary key!') --- 18,21 ---- *************** *** 28,92 **** ## ! _connDict = {'database': 'STORE_EMPLOYEES'} ! model = Model('StoreEmployees',adaptorName='Postgresql', ! connDict=_connDict) ! model.doc = ' ... ' ! model.version='0.1' ! model.entities = [ ! ! # ! Entity('Store', ! properties=[ AString('corporateName', isRequired=1), ], ! ), ! ! Entity('Employee', ! properties=[ AString('lastName',isRequired=1,usedForLocking=1, ! width=20), ! AString('firstName', isRequired=1, width=50, ! usedForLocking=1), ! ] ! ), ! Entity('SalesClerk', parent='Employee', ! properties=[ AString('storeArea', width=20) ] ! ), ! ! Entity('Executive', parent='Employee', ! properties=[ AString('officeLocation', width=5) ] ! ), ! ! Entity('Address', ! properties=[ AString('street', width=80), ! AString('zipCode', width=10), ! AString('town'), ! ] ! ), ! ! Entity('Mark', ! properties=[ AInteger('month', isRequired=1), ! AInteger('mark', isRequired=1), ! ] ! ) - ] - model.associations=[ - Association('Mark', 'Executive', - relations=['executive', 'marks'], - delete=['nullify', 'cascade'], - keys=['FK_Executive_id', 'id']), - Association('Address', 'Employee', - relations=['toEmployee', 'toAddresses'], - delete=['deny', 'cascade'], - keys=['fkEmployeeId', 'id'], - ), - Association('Employee', 'Store', - relations=['toStore', 'employees'], - delete=['nullify', 'deny'], - keys=['fkStoreId', 'id']), - ] - if __name__ == '__main__': model.build() ! #print model.validate() ! #print model.toXML() ! # plus whatever ... ! ## --- 24,82 ---- ## ! def pymodel(): ! _connDict = {'database': 'STORE_EMPLOYEES'} ! model = Model('StoreEmployees',adaptorName='Postgresql', ! connDict=_connDict) ! model.doc = ' ... ' ! model.version='0.1' ! model.entities = [ ! # ! Entity('Store', ! properties=[ AString('corporateName', isRequired=1), ], ! ), ! Entity('Employee', ! properties=[ AString('lastName',isRequired=1,usedForLocking=1, ! width=20), ! AString('firstName', isRequired=1, width=50, ! usedForLocking=1), ! ] ! ), ! Entity('SalesClerk', parent='Employee', ! properties=[ AString('storeArea', width=20) ] ! ), ! Entity('Executive', parent='Employee', ! properties=[ AString('officeLocation', width=5) ] ! ), ! Entity('Address', ! properties=[ AString('street', width=80), ! AString('zipCode', width=10), ! AString('town'), ! ] ! ), ! Entity('Mark', ! properties=[ AInteger('month', isRequired=1), ! AInteger('mark', isRequired=1), ! ] ! ) ! ] ! model.associations=[ ! Association('Mark', 'Executive', ! relations=['executive', 'marks'], ! delete=['nullify', 'cascade'], ! keys=['FK_Executive_id', 'id']), ! Association('Address', 'Employee', ! relations=['toEmployee', 'toAddresses'], ! delete=['deny', 'cascade'], ! keys=['fkEmployeeId', 'id'], ! ), ! Association('Employee', 'Store', ! relations=['toStore', 'employees'], ! delete=['nullify', 'deny'], ! keys=['fkStoreId', 'id']), ! ] model.build() ! return model ! def model(): ! return pymodel().component |