modeling-cvs Mailing List for Object-Relational Bridge for python (Page 28)
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
|
|
From: <sbi...@us...> - 2003-05-25 18:55:39
|
Update of /cvsroot/modeling/NotificationFramework/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv25725/tests
Modified Files:
utils.py
Log Message:
Fixed: NF path should be inserted at the beginning of sys.path
Index: utils.py
===================================================================
RCS file: /cvsroot/modeling/NotificationFramework/tests/utils.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** utils.py 10 Jan 2003 10:45:44 -0000 1.2
--- utils.py 25 May 2003 18:55:36 -0000 1.3
***************
*** 33,41 ****
codedir = os.path.dirname(os.path.dirname(mydir))
if codedir not in sys.path:
! sys.path.append(codedir)
if zope_path and zope_path not in sys.path:
! sys.path.append(zope_path)
- #fixpath()
import unittest
--- 33,40 ----
codedir = os.path.dirname(os.path.dirname(mydir))
if codedir not in sys.path:
! sys.path=[codedir]+sys.path
if zope_path and zope_path not in sys.path:
! sys.path=[zope_path]+sys.path
import unittest
|
|
From: <sbi...@us...> - 2003-05-20 14:25:39
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/xmlmodels
In directory sc8-pr-cvs1:/tmp/cvs-serv24689/xmlmodels
Modified Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
model_AuthorBooks.xml
Log Message:
Minor update (removed connDict info from model)
Index: model_AuthorBooks.xml
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/xmlmodels/model_AuthorBooks.xml,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.4.1
diff -C2 -d -r1.1.1.1 -r1.1.1.1.4.1
*** model_AuthorBooks.xml 30 Jul 2002 15:38:56 -0000 1.1.1.1
--- model_AuthorBooks.xml 20 May 2003 14:25:35 -0000 1.1.1.1.4.1
***************
*** 1,5 ****
<?xml version='1.0' encoding='iso-8859-1'?>
! <!DOCTYPE model>
! <model name='AuthorBooks' packageName='AuthorBooks' adaptorName='Postgresql' connectionDictionary="{'database': 'AUTHOR_BOOKS', 'user': 'postgres', 'password': '', 'host': 'localhost'}">
<entity isReadOnly='0' externalName='WRITER' name='Writer' parentEntity='' className='Writer' typeName='Writer' isAbstract='0'>
<primaryKey attributeName='id'/>
--- 1,5 ----
<?xml version='1.0' encoding='iso-8859-1'?>
! <!-- <!DOCTYPE model SYSTEM "mdl_model.dtd"> -->
! <model name='AuthorBooks' packageName='AuthorBooks' adaptorName='' connectionDictionary="{'database': 'AUTHOR_BOOKS', 'user': '', 'password': '', 'host': ''}">
<entity isReadOnly='0' externalName='WRITER' name='Writer' parentEntity='' className='Writer' typeName='Writer' isAbstract='0'>
<primaryKey attributeName='id'/>
***************
*** 7,16 ****
<attributesUsedForLocking attributeName='lastName'/>
<attributesUsedForLocking attributeName='age'/>
! <attribute isClassProperty='1' width='40' columnName='FIRST_NAME' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' name='firstName' scale='0' type='string' displayLabel='First Name'/>
! <attribute isClassProperty='1' width='30' columnName='LAST_NAME' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' name='lastName' scale='0' type='string' displayLabel='Last Name'/>
! <attribute isClassProperty='1' width='0' columnName='AGE' isRequired='0' precision='0' defaultValue='0' externalType='INTEGER' name='age' scale='0' type='int' displayLabel='Age'/>
! <attribute isClassProperty='0' width='0' columnName='ID' isRequired='1' precision='0' defaultValue='0' externalType='INTEGER' name='id' scale='0' type='int' displayLabel=''/>
! <attribute isClassProperty='0' width='0' columnName='FK_WRITER_ID' isRequired='0' precision='0' defaultValue='0' externalType='INTEGER' name='FK_Writer_id' scale='0' type='int' displayLabel=''/>
! <attribute isClassProperty='1' width='0' columnName='BIRTHDAY' isRequired='0' precision='0' defaultValue='None' externalType='TIMESTAMP' name='birthday' scale='0' type='DateTime' displayLabel='birthday'/>
<relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Book' name='books' displayLabel='' joinSemantic='0'>
<join sourceAttribute='id' destinationAttribute='FK_Writer_Id'/>
--- 7,16 ----
<attributesUsedForLocking attributeName='lastName'/>
<attributesUsedForLocking attributeName='age'/>
! <attribute isClassProperty='1' columnName='FIRST_NAME' name='firstName' isRequired='0' precision='0' defaultValue='None' externalType='VARCHAR' width='40' scale='0' type='string' displayLabel='First Name'/>
! <attribute isClassProperty='1' columnName='LAST_NAME' name='lastName' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' width='30' scale='0' type='string' displayLabel='Last Name'/>
! <attribute isClassProperty='1' columnName='AGE' name='age' isRequired='0' precision='0' defaultValue='0' externalType='INTEGER' width='0' scale='0' type='int' displayLabel='Age'/>
! <attribute isClassProperty='0' columnName='ID' name='id' isRequired='1' precision='0' defaultValue='0' externalType='INTEGER' width='0' scale='0' type='int' displayLabel=''/>
! <attribute isClassProperty='0' columnName='FK_WRITER_ID' name='FK_Writer_id' isRequired='0' precision='0' defaultValue='0' externalType='INTEGER' width='0' scale='0' type='int' displayLabel=''/>
! <attribute isClassProperty='1' columnName='BIRTHDAY' name='birthday' isRequired='0' precision='0' defaultValue='None' externalType='TIMESTAMP' width='0' scale='0' type='DateTime' displayLabel='birthday'/>
<relation deleteRule='2' isClassProperty='1' multiplicityUpperBound='-1' multiplicityLowerBound='0' destinationEntity='Book' name='books' displayLabel='' joinSemantic='0'>
<join sourceAttribute='id' destinationAttribute='FK_Writer_Id'/>
***************
*** 25,32 ****
<attributesUsedForLocking attributeName='id'/>
<attributesUsedForLocking attributeName='FK_Writer_Id'/>
! <attribute isClassProperty='1' width='40' columnName='title' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' name='title' scale='0' type='string' displayLabel='Title'/>
! <attribute isClassProperty='0' width='0' columnName='id' isRequired='1' precision='0' defaultValue='0' externalType='INT' name='id' scale='0' type='int' displayLabel=''/>
! <attribute isClassProperty='0' width='0' columnName='FK_WRITER_ID' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' name='FK_Writer_Id' scale='0' type='string' displayLabel=''/>
! <attribute isClassProperty='1' width='0' columnName='PRICE' isRequired='0' precision='10' defaultValue='None' externalType='NUMERIC' name='price' scale='2' type='float' displayLabel=''/>
<relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Writer' name='author' displayLabel='' joinSemantic='0'>
<join sourceAttribute='FK_Writer_Id' destinationAttribute='id'/>
--- 25,32 ----
<attributesUsedForLocking attributeName='id'/>
<attributesUsedForLocking attributeName='FK_Writer_Id'/>
! <attribute isClassProperty='1' columnName='title' name='title' isRequired='1' precision='0' defaultValue='None' externalType='VARCHAR' width='40' scale='0' type='string' displayLabel='Title'/>
! <attribute isClassProperty='1' columnName='id' name='id' isRequired='1' precision='0' defaultValue='0' externalType='INT' width='0' scale='0' type='int' displayLabel=''/>
! <attribute isClassProperty='0' columnName='FK_WRITER_ID' name='FK_Writer_Id' isRequired='0' precision='0' defaultValue='None' externalType='INTEGER' width='0' scale='0' type='string' displayLabel=''/>
! <attribute isClassProperty='1' columnName='PRICE' name='price' isRequired='0' precision='10' defaultValue='None' externalType='NUMERIC' width='0' scale='2' type='float' displayLabel=''/>
<relation deleteRule='0' isClassProperty='1' multiplicityUpperBound='1' multiplicityLowerBound='0' destinationEntity='Writer' name='author' displayLabel='' joinSemantic='0'>
<join sourceAttribute='FK_Writer_Id' destinationAttribute='id'/>
|
|
From: <sbi...@us...> - 2003-05-20 14:24:47
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/xmlmodels
In directory sc8-pr-cvs1:/tmp/cvs-serv23937/xmlmodels
Added Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
model_StoreEmployees.xml model_StoreEmployees.xml2
model_StoreEmployees.xml3
Log Message:
* Added tests/test_generate_python_code.sh: tests the generation of python
code in different situations, and it also checks that the appropriate
python test (such as test_EditingContext_Global.py) succeeds with the
generated code.
Also added: xmlmodels/model_StoreEmployees.xml[2|3]
--- NEW FILE: model_StoreEmployees.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='SalesClerk' 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='Executive' 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_StoreEmployees.xml2 ---
<?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_StoreEmployees.xml3 ---
<?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>
|
|
From: <sbi...@us...> - 2003-05-20 14:24:47
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv23937
Added Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
test_generate_python_code.sh
Log Message:
* Added tests/test_generate_python_code.sh: tests the generation of python
code in different situations, and it also checks that the appropriate
python test (such as test_EditingContext_Global.py) succeeds with the
generated code.
Also added: xmlmodels/model_StoreEmployees.xml[2|3]
--- NEW FILE: test_generate_python_code.sh ---
#! /bin/sh
GENERATE=../scripts/mdl_generate_python_code.py
RMDIR='/bin/rm -rf'
function test_AuthorBooks() {
./test_EditingContext_Global.py > /dev/null 2>&1
}
function test_StoreEmployees() {
./test_EditingContext_Global_Inheritance.py > /dev/null 2>&1
}
tests_dir=`pwd`
mdl_dir=`dirname $tests_dir`
export PYTHONPATH=`dirname $mdl_dir`:$PYTHONPATH
##--------
function check_success() {
if [ $? -ne 0 ]; then
echo "ERROR: Failed: $1" 1>&2
else
echo "OK: Success: $1"
fi
}
function check_failure() {
if [ $? -ne 0 ]; then
echo "OK: Failed: $1" 1>&2
else
echo "ERROR: Success: $1"
fi
}
function generate() {
$GENERATE $* > /dev/null 2>&1
}
## Save the original trestPackages directories
cp -Rp testPackages/AuthorBooks testPackages/AuthorBooks.ori
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
\rm -rf AuthorBooks
\rm -rf StoreEmployees
cp -Rp testPackages/AuthorBooks.ori testPackages/AuthorBooks && \
$RMDIR testPackages/AuthorBooks.ori
cp -Rp testPackages/StoreEmployees.ori testPackages/StoreEmployees && \
$RMDIR testPackages/StoreEmployees.ori
|
|
From: <ru...@us...> - 2003-05-19 16:05:19
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/doc
In directory sc8-pr-cvs1:/tmp/cvs-serv20819
Modified Files:
UserGuide.tex abstract.tex
Log Message:
minor review; FAQ in Appendix; start PyModels doc; deleted 4.8
Index: UserGuide.tex
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/UserGuide.tex,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** UserGuide.tex 6 May 2003 13:52:01 -0000 1.19
--- UserGuide.tex 19 May 2003 16:05:16 -0000 1.20
***************
*** 49,52 ****
--- 49,53 ----
\appendix
\input{UserGuide/EnvironmentVariables}
+ \input{UserGuide/FAQ}
%
% The ugly "%begin{latexonly}" pseudo-environments are really just to
Index: abstract.tex
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/doc/abstract.tex,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** abstract.tex 20 Feb 2003 21:38:59 -0000 1.3
--- abstract.tex 19 May 2003 16:05:16 -0000 1.4
***************
*** 2,7 ****
relational databases. It relies on a model, based on Entity-Relationship
Modelling, that describes how the two worlds map to each other. From your design
! of such a model, the database's schema and the python code templates for your classes
! are automatically generated, ready to be used. Thus,
once you have designed how your classes should be stored in the RDBMS, you can
focus on the real challenges -- the logic of your business objects -- while
--- 2,7 ----
relational databases. It relies on a model, based on Entity-Relationship
Modelling, that describes how the two worlds map to each other. From your design
! of such a model, the database's schema and corresponding python classes
! are automatically generated. Thus,
once you have designed how your classes should be stored in the RDBMS, you can
focus on the real challenges -- the logic of your business objects -- while
|
|
From: <sbi...@us...> - 2003-05-19 10:39:32
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv29931
Modified Files:
Tag: brch-0_9pre7-1-PyModel
PyModel.py
Log Message:
Replaced integer value for delete rules with its corresponding string
Index: PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attic/PyModel.py,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** PyModel.py 18 May 2003 16:36:15 -0000 1.1.2.4
--- PyModel.py 19 May 2003 10:39:26 -0000 1.1.2.5
***************
*** 597,601 ****
class BaseRelation(BaseDescription):
''' Describes a Relation '''
! defaults={ 'delete': 0, # nullify
#'key': 0,
#'destinationEntity': '',
--- 597,601 ----
class BaseRelation(BaseDescription):
''' Describes a Relation '''
! defaults={ 'delete': 'nullify',
#'key': 0,
#'destinationEntity': '',
|
|
From: <sbi...@us...> - 2003-05-19 10:38:10
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv29379/tests
Modified Files:
Tag: brch-0_9pre7-1-PyModel
test_PyModel.py
Log Message:
Added tests for Associations' defaults
Index: test_PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/Attic/test_PyModel.py,v
retrieving revision 1.1.2.4
retrieving revision 1.1.2.5
diff -C2 -d -r1.1.2.4 -r1.1.2.5
*** test_PyModel.py 18 May 2003 16:04:14 -0000 1.1.2.4
--- test_PyModel.py 19 May 2003 10:38:07 -0000 1.1.2.5
***************
*** 404,407 ****
--- 404,456 ----
self.failIf(mark.propertyNamed('toEmployee').deleteRule()!='nullify')
+ # Check Association's defaults
+ ass_def_delete=Association.defaults['delete']
+ try:
+ Association.defaults['delete']=['deny', 'cascade']
+ self.setUp()
+ model=self.model
+ model.entities = [ Entity('Employee'), Entity('Mark'), Entity('Store'),
+ Entity('SalesClerk', parent='Employee'), ]
+ model.associations = [
+ Association('Employee', 'Store'), Association('Mark', 'Employee'), ]
+ model.build()
+ self.check_model(model)
+ self.check_inverse_rels(model)
+ emp=model.component.entityNamed('Employee')
+ mark=model.component.entityNamed('Mark')
+ store=model.component.entityNamed('Store')
+ self.failIf(emp.propertyNamed('toStore').deleteRule()!='deny')
+ self.failIf(emp.propertyNamed('toMarks').deleteRule()!='cascade')
+ self.failIf(store.propertyNamed('toEmployees').deleteRule()!='cascade')
+ self.failIf(mark.propertyNamed('toEmployee').deleteRule()!='deny')
+ finally:
+ Association.defaults['delete']=ass_def_delete # restore
+
+ # Association's defaults are NOT related to RToOne/RToMany defaults
+ toOne_def_delete=RToOne.defaults['delete']
+ toMany_def_delete=RToMany.defaults['delete']
+ RToOne.defaults['delete']=['deny']
+ RToOne.defaults['delete']=['cascade']
+ try:
+ self.setUp()
+ model=self.model
+ model.entities = [ Entity('Employee'), Entity('Mark'), Entity('Store'),
+ Entity('SalesClerk', parent='Employee'), ]
+ model.associations = [
+ Association('Employee', 'Store'), Association('Mark', 'Employee'), ]
+ model.build()
+ self.check_model(model)
+ self.check_inverse_rels(model)
+ emp=model.component.entityNamed('Employee')
+ mark=model.component.entityNamed('Mark')
+ store=model.component.entityNamed('Store')
+ self.failIf(emp.propertyNamed('toStore').deleteRule()=='deny')
+ self.failIf(emp.propertyNamed('toMarks').deleteRule()=='cascade')
+ self.failIf(store.propertyNamed('toEmployees').deleteRule()=='cascade')
+ self.failIf(mark.propertyNamed('toEmployee').deleteRule()=='deny')
+ finally:
+ RToOne.defaults['delete']=toOne_def_delete
+ RToOne.defaults['delete']=toMany_def_delete
+
def test_suite():
suite = unittest.TestSuite()
|
|
From: <sbi...@us...> - 2003-05-19 10:37:27
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees
In directory sc8-pr-cvs1:/tmp/cvs-serv29024/tests/testPackages/StoreEmployees
Modified Files:
Tag: brch-0_9pre7-1-PyModel
pymodel_StoreEmployees.py
Log Message:
Removed useless defaults for RToOne/RToMany, added defaults for associations, and updated the model so that the delete rules for relationships created by Associations are the same than in the xml model
Index: pymodel_StoreEmployees.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/Attic/pymodel_StoreEmployees.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** pymodel_StoreEmployees.py 18 May 2003 16:03:30 -0000 1.1.2.2
--- pymodel_StoreEmployees.py 19 May 2003 10:37:23 -0000 1.1.2.3
***************
*** 16,28 ****
AString.defaults['width'] = 30
! RToOne.defaults['delete'] = 'nullify'
! RToOne.defaults['multiplicity'] = [0,1]
! #RToOne.defaults['sourceAttribute'] = RToOne.attNameFromRel # 'fk'+destEnt+destAtt+count
! #RToOne.defaults['destinationAttribute'] = 'id'
!
! RToMany.defaults['delete'] = 'cascade'
! RToMany.defaults['multiplicity'] = [0,None]
! #RToMany.defaults['sourceAttribute'] = 'id'
! #RToMany.defaults['destinationAttribute'] = RToMany.attNameFromRel # fk+destEnt+sourceAtt+count
# Note that Relation.attNameFromRel is a callable, that calculates the att
--- 16,20 ----
AString.defaults['width'] = 30
! Association.defaults['delete']=['nullify', 'nullify']
# Note that Relation.attNameFromRel is a callable, that calculates the att
***************
*** 80,89 ****
Association('Mark', 'Executive',
relations=['executive', 'marks'],
keys=['FK_Executive_id', 'id']),
Association('Address', 'Employee',
relations=['toEmployee', 'toAddresses'],
! keys=['fkEmployeeId', 'id']),
Association('Employee', 'Store',
relations=['toStore', 'employees'],
keys=['fkStoreId', 'id']),
]
--- 72,85 ----
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']),
]
|
|
From: <sbi...@us...> - 2003-05-18 23:29:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv19459
Modified Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
CHANGES
Log Message:
Updated
Index: CHANGES
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v
retrieving revision 1.95.2.2
retrieving revision 1.95.2.3
diff -C2 -d -r1.95.2.2 -r1.95.2.3
*** CHANGES 18 May 2003 23:28:24 -0000 1.95.2.2
--- CHANGES 18 May 2003 23:29:47 -0000 1.95.2.3
***************
*** 19,22 ****
--- 19,23 ----
mdl_generate_python_code
+ [2003/05/16]
* scripts/mdl_generate_python_code (option -B),
PyModelMason.checkModelIsValid()): the 'base' scheme cannot generate a
|
|
From: <sbi...@us...> - 2003-05-18 23:28:29
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons
In directory sc8-pr-cvs1:/tmp/cvs-serv17811/ModelMasons
Modified Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
ModelMason.py PyModelMason.py
Log Message:
* Updated documentation for ModelMason and PyModelMason
* Added fake_mode to ModelMason, PyModelMason and option -n/--dry-run in
mdl_generate_python_code
* scripts/mdl_generate_python_code (option -B),
PyModelMason.checkModelIsValid()): the 'base' scheme cannot generate
a python-package from a model where a class and at least one of its
(direct or indirect) subclasses leave in the same module. This is
now checked and correctly reported when the generation cannot be
done.
Index: ModelMason.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/ModelMason.py,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -C2 -d -r1.6 -r1.6.2.1
*** ModelMason.py 20 Apr 2003 14:16:42 -0000 1.6
--- ModelMason.py 18 May 2003 23:28:24 -0000 1.6.2.1
***************
*** 24,30 ****
"""
- ModelMason
! Documentation forthcoming. See PyModelMason for an example of use.
CVS information
--- 24,34 ----
"""
! ModelMason contains the base class for every ''mason'' and is of no interest
! except if you plan to design a new module to generate code/files from a Model.
!
! When this is the case, the class' documentation indicate the rules that should
! be respected to ensure easy integration with the framework's tools such as the
! script mdl_generate_python_code or the ZModeler.
CVS information
***************
*** 40,46 ****
class ModelMason:
def __init__(self, model, rootPath, concreteBuilder, bricksDir,
! verbose_mode=0):
"""
Initializes the ModelMason so that the built files are based on the
--- 44,84 ----
class ModelMason:
+ """
+ This class should be the base class for every masons.
+
+ When subclassing this class, you should take care of:
+
+ - call ModelMason.__init__() if it is overridden
+
+ - if the subclass needs to change/create sth. on the filesystem, it *must*
+ check whether 'fake_mode' is set: if it is set, absolutely no changes
+ should be made on the disk.
+
+ Methods createEmptyFile(), createFileFromTemplate(), copyFile() and
+ build_package() can be used without this precaution since they already
+ check 'self.fake_mode' before making any changes on the disk.
+
+ - call log() to record any action relative to the generation (such as the
+ creation of a file). Please note that you should be ready to log these
+ actions even when fake_mode is set. For example, suppose 'file.py'
+ should be generated but not overwritten; if the file does not exist
+ you'd log('Creating file file.py'), and if it exists you'd log('File.py
+ exists, skipping') whether fake_mode is set or not. This makes it
+ possible for the user to see what would happen whene (re)generating the
+ code without actually making the changes.
+
+ Following these rules makes it easy to integrate a custom ''mason'' into
+ the script mdl_generate_python_code and the ZModeler.
+
+ All subclasses need to override build() and put there the logic which
+ generates the code. You will probably override method tmpl_namespace() as
+ well (see its documentation for details).
+
+ You can also refer to PyModelMason for an example of use.
+
+ """
def __init__(self, model, rootPath, concreteBuilder, bricksDir,
! verbose_mode=0, fake_mode=0):
"""
Initializes the ModelMason so that the built files are based on the
***************
*** 64,67 ****
--- 102,108 ----
generating the files
+ fake_mode -- if true, do not create or change any file, just report what
+ would be done
+
Subclasses may decide to supply a default value for the product's base
directory when parameter 'rootPath' is not supplied.
***************
*** 75,79 ****
bricksDir)
self.verbose_mode=verbose_mode
!
def fullPathForBrick(self, aBrick):
"""
--- 116,121 ----
bricksDir)
self.verbose_mode=verbose_mode
! self.fake_mode=fake_mode
!
def fullPathForBrick(self, aBrick):
"""
***************
*** 98,103 ****
return
self.log('Creating empty file %s\n'%filename)
! f = open(filename,"w")
! f.close()
def copyFile(self, templateFilename, destinationFilename,overwrite=0):
--- 140,146 ----
return
self.log('Creating empty file %s\n'%filename)
! if not self.fake_mode:
! f = open(filename,"w")
! f.close()
def copyFile(self, templateFilename, destinationFilename,overwrite=0):
***************
*** 113,121 ****
return
self.log('Creating file %s\n'%destinationFilename)
! _f1 = open(self.fullPathForGeneratedFile(destinationFilename),'w')
! _f2 = open(self.fullPathForBrick(templateFilename),'r')
! _f1.write(_f2.read())
! _f1.close()
! _f2.close()
_marker=[]
--- 156,165 ----
return
self.log('Creating file %s\n'%destinationFilename)
! if not self.fake_mode:
! _f1 = open(self.fullPathForGeneratedFile(destinationFilename),'w')
! _f2 = open(self.fullPathForBrick(templateFilename),'r')
! _f1.write(_f2.read())
! _f1.close()
! _f2.close()
_marker=[]
***************
*** 162,169 ****
self.log("File %s exists, skipping\n"%destFile)
return
! self.log("Generating %s... " % destFile)
! f = open(destFile,'w')
! f.write("%s"%self.templateObjectForTemplate(template,namespace=namespace))
! self.log("done\n")
def build(self):
--- 206,219 ----
self.log("File %s exists, skipping\n"%destFile)
return
! if not overwrite:
! self.log("Generating %s" % destFile)
! else:
! self.log("Overwriting %s" % destFile)
!
! if not self.fake_mode:
! f = open(destFile,'w')
! f.write("%s"%self.templateObjectForTemplate(template,namespace=namespace))
! self.log("... done")
! self.log('\n')
def build(self):
***************
*** 201,205 ****
{'model': self.model}
! Subclasses override this method to provide their own namespace
"""
return {'model': self.model}
--- 251,257 ----
{'model': self.model}
! Subclasses override this method to provide their own namespace. This
! namespace is the default one transmitted to the Cheetah template when no
! specific namespace is passed to method createFileFromTemplate().
"""
return {'model': self.model}
***************
*** 215,224 ****
for pack in string.split(self.model.packageName(), '.')[:-1]:
currentPath=os.path.join(currentPath, pack)
! self.log('Creating directory %s... '%currentPath)
! try:
! os.mkdir(currentPath)
! except: self.log('no\n')
! else: self.log('ok\n')
!
init=os.path.join(currentPath, '__init__.py')
if os.path.exists(init):
--- 267,278 ----
for pack in string.split(self.model.packageName(), '.')[:-1]:
currentPath=os.path.join(currentPath, pack)
! self.log('Creating directory %s'%currentPath)
! if not self.fake_mode:
! try:
! os.mkdir(currentPath)
! except: self.log('... no')
! else: self.log('... ok')
! self.log('\n')
!
init=os.path.join(currentPath, '__init__.py')
if os.path.exists(init):
***************
*** 226,237 ****
else:
self.log('Creating %s\n'%init)
! f=open(init,'w') ; f.close()
# Last, create self.packagePath
! self.log('Creating directory %s... '%self.packagePath)
! try:
! os.mkdir(self.packagePath)
! except: self.log('no\n')
! else: self.log('ok\n')
def log(self, msg):
--- 280,294 ----
else:
self.log('Creating %s\n'%init)
! if not self.fake_mode:
! f=open(init,'w') ; f.close()
# Last, create self.packagePath
! self.log('Creating directory %s'%self.packagePath)
! if not self.fake_mode:
! try:
! os.mkdir(self.packagePath)
! except: self.log('... no')
! else: self.log('... ok')
! self.log('\n')
def log(self, msg):
Index: PyModelMason.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/PyModelMason.py,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -C2 -d -r1.8.2.2 -r1.8.2.3
*** PyModelMason.py 16 May 2003 11:04:40 -0000 1.8.2.2
--- PyModelMason.py 18 May 2003 23:28:24 -0000 1.8.2.3
***************
*** 24,31 ****
"""
! PyModelMason
! Documentation forthcoming
CVS information
--- 24,45 ----
"""
! PyModelMason generates the python package, modules and classes described
! in a model, ready to be used w/ the modeling framework.
! Its templates are located in sub-package 'Python_bricks'. The generated code
! is compatible with python v2.1 and v2.2.
+ Given a model, it can generate the appropriate python code in two different
+ ways: the flat, or 'compact' scheme, and the 'base' scheme.
+
+ The former one generates all files within a single directory (namely: in
+ package model.packageName()), none of which (except the models) can be
+ overwritten when the code is regenerated.
+
+ The so-called 'base' scheme adds a subpackage 'MDL' within the generated
+ package. All files within MDL/ are ALWAYS overwritten when the python code is
+ regenerated, while others (in the root package) are never overwritten if they
+ exist. This is probably the one you want to use if your model changes often.
+
CVS information
***************
*** 98,103 ****
class PyModelMason(ModelMason):
def __init__(self, model, rootPath=None, verbose_mode=0,
! generation_scheme='compact'):
"""
Initializes the ModelMason so that the built files are based on the
--- 112,118 ----
class PyModelMason(ModelMason):
+ "See the module's documentation for details"
def __init__(self, model, rootPath=None, verbose_mode=0,
! generation_scheme='compact', fake_mode=0):
"""
Initializes the ModelMason so that the built files are based on the
***************
*** 106,117 ****
Parameters:
! model --
! rootPath --
! verbode_mode --
use_scheme -- 'compact' or 'base'
"""
import Modeling
--- 121,134 ----
Parameters:
! model -- see ModelMason.__init__()
! rootPath -- see ModelMason.__init__()
! verbode_mode -- see ModelMason.__init__()
use_scheme -- 'compact' or 'base'
+ fake_mode -- see ModelMason.__init__()
+
"""
import Modeling
***************
*** 121,125 ****
ModelMason.__init__(self, model, rootPath,
Modeling.ModelMasons.PyModelMason, 'Python_bricks',
! verbose_mode)
self._entities=[] # used during build
self.generation_scheme=generation_scheme
--- 138,142 ----
ModelMason.__init__(self, model, rootPath,
Modeling.ModelMasons.PyModelMason, 'Python_bricks',
! verbose_mode, fake_mode)
self._entities=[] # used during build
self.generation_scheme=generation_scheme
***************
*** 145,156 ****
def create_model_files(self, xml_path, py_path):
# model_<modelName>.xml
! self.log('Generating %s... '%xml_path)
! self.model.saveModelAsXMLFile(xml_path)
! self.log('done\n')
!
# model_<modelName>.py
! xml=open(xml_path)
! modelStr=xml.read()
! xml.close()
self.createFileFromTemplate(model.model(),
py_path,
--- 162,177 ----
def create_model_files(self, xml_path, py_path):
# model_<modelName>.xml
! self.log('Generating %s'%xml_path)
! if not self.fake_mode:
! self.model.saveModelAsXMLFile(xml_path)
! self.log('... done')
! self.log('\n')
# model_<modelName>.py
! if not self.fake_mode:
! xml=open(xml_path)
! modelStr=xml.read()
! xml.close()
! else:
! modelStr='fake'
self.createFileFromTemplate(model.model(),
py_path,
***************
*** 193,201 ****
# create 'Base' and model files (.xml/.py)
basePath=self.fullPathForGeneratedFile(self.base_dir)
! self.log("Creating directory %s... "%basePath)
! try:
! os.mkdir(basePath)
! except: self.log('no\n')
! else: self.log('ok\n')
self.createFileFromTemplate(init_base.init_base(),
os.path.join(self.base_dir,"__init__.py"),
--- 214,223 ----
# create 'Base' and model files (.xml/.py)
basePath=self.fullPathForGeneratedFile(self.base_dir)
! self.log("Creating directory %s"%basePath)
! if not self.fake_mode:
! try:
! os.mkdir(basePath)
! except: self.log('no\n')
! else: self.log('ok\n')
self.createFileFromTemplate(init_base.init_base(),
os.path.join(self.base_dir,"__init__.py"),
|
|
From: <sbi...@us...> - 2003-05-18 23:28:29
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/scripts
In directory sc8-pr-cvs1:/tmp/cvs-serv17811/scripts
Modified Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
mdl_generate_python_code.py
Log Message:
* Updated documentation for ModelMason and PyModelMason
* Added fake_mode to ModelMason, PyModelMason and option -n/--dry-run in
mdl_generate_python_code
* scripts/mdl_generate_python_code (option -B),
PyModelMason.checkModelIsValid()): the 'base' scheme cannot generate
a python-package from a model where a class and at least one of its
(direct or indirect) subclasses leave in the same module. This is
now checked and correctly reported when the generation cannot be
done.
Index: mdl_generate_python_code.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/scripts/mdl_generate_python_code.py,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -C2 -d -r1.4.2.1 -r1.4.2.2
*** mdl_generate_python_code.py 16 May 2003 11:33:24 -0000 1.4.2.1
--- mdl_generate_python_code.py 18 May 2003 23:28:24 -0000 1.4.2.2
***************
*** 55,60 ****
del tb
! def build_python_code(model, generation_scheme,
! rootPath=None, typeOfCode='python', verbose_mode=0):
"""
Builds the python-code templates for the supplied model
--- 55,60 ----
del tb
! def build_python_code(model, generation_scheme, rootPath=None,
! typeOfCode='python', verbose_mode=0, fake_mode=0):
"""
Builds the python-code templates for the supplied model
***************
*** 75,78 ****
--- 75,80 ----
is false.
+ fake_mode -- if true, do not create or change any file, just report what
+ would be done
Raises TargetDirectoryAlreadyExists if 'overwrite' is false and the target
***************
*** 86,90 ****
from Modeling.ModelMasons.PyModelMason import PyModelMason
mason = PyModelMason(model, rootPath, verbose_mode=verbose_mode,
! generation_scheme=generation_scheme)
mason.build()
--- 88,93 ----
from Modeling.ModelMasons.PyModelMason import PyModelMason
mason = PyModelMason(model, rootPath, verbose_mode=verbose_mode,
! generation_scheme=generation_scheme,
! fake_mode=fake_mode)
mason.build()
***************
*** 104,110 ****
General options:
----------------
! -h --help gives this help
! -v --verbose verbose mode (default)
! -q --quiet quiet mode
Generation options:
--- 107,115 ----
General options:
----------------
! -h --help gives this help
! -n --dry-run do not create or change any file, just report what would
! be done
! -q --quiet quiet mode
! -v --verbose verbose mode (default)
Generation options:
***************
*** 120,125 ****
'compact' scheme: puts all generated file in the same directory (the package
! for the model). When re-generating the files, a file that
! already exists is NEVER overwritten
'base' scheme: adds a sub-module 'MDL' within the generated package. All files
--- 125,131 ----
'compact' scheme: puts all generated file in the same directory (the package
! for the model). When re-generating the files, only the two files
! containing the model are overwritten, every other file that already exists
! is never overwritten
'base' scheme: adds a sub-module 'MDL' within the generated package. All files
***************
*** 141,152 ****
me=args[0]
try: options, args = getopt.getopt(sys.argv[1:],
! 'BCg:hqv',
["help", "quiet", "verbose",
"generation_scheme=",
"compact-generation-scheme",
! "base-generation-scheme"])
except: usage(me); return 1
global verbose
generation_scheme='compact'
for k, v in options:
if k in ('-h', '--help'): usage(me); return 0
--- 147,160 ----
me=args[0]
try: options, args = getopt.getopt(sys.argv[1:],
! 'BCg:hnqv',
["help", "quiet", "verbose",
"generation_scheme=",
"compact-generation-scheme",
! "base-generation-scheme",
! "dry-run"])
except: usage(me); return 1
global verbose
generation_scheme='compact'
+ fake_mode=0
for k, v in options:
if k in ('-h', '--help'): usage(me); return 0
***************
*** 155,158 ****
--- 163,167 ----
if k in ('-C', '--compact-generation-scheme'): generation_scheme='compact'; continue
if k in ('-B', '--base-generation-scheme'): generation_scheme='base'; continue
+ if k in ('-n', '--dry-run'): fake_mode=1; continue
if len(args) not in (1,2): usage(me) ; return 1
***************
*** 174,178 ****
model=ms.models()[0]
try:
! build_python_code(model, generation_scheme, rootPath, verbose_mode=verbose)
except TargetDirectoryAlreadyExists, exc:
sys.stderr.write(str(sys.exc_info()[1])+'\n')
--- 183,188 ----
model=ms.models()[0]
try:
! build_python_code(model, generation_scheme, rootPath, verbose_mode=verbose,
! fake_mode=fake_mode)
except TargetDirectoryAlreadyExists, exc:
sys.stderr.write(str(sys.exc_info()[1])+'\n')
|
|
From: <sbi...@us...> - 2003-05-18 23:28:29
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv17811
Modified Files:
Tag: brch-0_9pre6-1-ModelMasons_base_generation_scheme
CHANGES
Log Message:
* Updated documentation for ModelMason and PyModelMason
* Added fake_mode to ModelMason, PyModelMason and option -n/--dry-run in
mdl_generate_python_code
* scripts/mdl_generate_python_code (option -B),
PyModelMason.checkModelIsValid()): the 'base' scheme cannot generate
a python-package from a model where a class and at least one of its
(direct or indirect) subclasses leave in the same module. This is
now checked and correctly reported when the generation cannot be
done.
Index: CHANGES
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v
retrieving revision 1.95.2.1
retrieving revision 1.95.2.2
diff -C2 -d -r1.95.2.1 -r1.95.2.2
*** CHANGES 21 Apr 2003 22:53:05 -0000 1.95.2.1
--- CHANGES 18 May 2003 23:28:24 -0000 1.95.2.2
***************
*** 8,17 ****
--------------------------------------------------------
ModelMasons
! TODO: check the constraint for option -B: a package cannot be generated from
! a model where a class and at least one of its (direct or indirect)
! subclasses leave in the same module.
* Added the 'MDL' sub-directory containing the files that are overwritten
when mdl_generate_python_code.py (option: -B) regenerates a package
--- 8,29 ----
--------------------------------------------------------
+ Branch brch-0_9pre6-1-ModelMasons_base_generation_scheme
+ --------------------------------------------------------
+
ModelMasons
! [2003/05/19]
! * Updated documentation for ModelMason and PyModelMason
!
! * Added fake_mode to ModelMason, PyModelMason and option -n/--dry-run in
! mdl_generate_python_code
+ * scripts/mdl_generate_python_code (option -B),
+ PyModelMason.checkModelIsValid()): the 'base' scheme cannot generate a
+ python-package from a model where a class and at least one of its (direct
+ or indirect) subclasses leave in the same module. This is now checked and
+ correctly reported when the generation cannot be done.
+
+ [2003/04/21]
* Added the 'MDL' sub-directory containing the files that are overwritten
when mdl_generate_python_code.py (option: -B) regenerates a package
|
|
From: <sbi...@us...> - 2003-05-18 16:36:18
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv3963
Modified Files:
Tag: brch-0_9pre7-1-PyModel
PyModel.py
Log Message:
Fixed: defaults['doc']='' (and not None) for entities and attributes
Index: PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attic/PyModel.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.py 18 May 2003 16:02:20 -0000 1.1.2.3
--- PyModel.py 18 May 2003 16:36:15 -0000 1.1.2.4
***************
*** 248,252 ****
'properties': [],
'parent': '',
! 'doc': None,
}
def __init__(self, name, **kw):
--- 248,252 ----
'properties': [],
'parent': '',
! 'doc': '',
}
def __init__(self, name, **kw):
***************
*** 501,505 ****
'defaultValue': None,
'displayLabel': '',
! 'doc': None,
}
def __init__(self, name, **kw):
--- 501,505 ----
'defaultValue': None,
'displayLabel': '',
! 'doc': '',
}
def __init__(self, name, **kw):
|
|
From: <sbi...@us...> - 2003-05-18 16:04:18
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv22819/tests
Modified Files:
Tag: brch-0_9pre7-1-PyModel
test_PyModel.py
Log Message:
Associations: now also check that the created FK are correctly set
Index: test_PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/Attic/test_PyModel.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
*** test_PyModel.py 18 May 2003 15:28:15 -0000 1.1.2.3
--- test_PyModel.py 18 May 2003 16:04:14 -0000 1.1.2.4
***************
*** 396,399 ****
--- 396,402 ----
store=model.component.entityNamed('Store')
+ # check that the fk are set as expected
+ self.failUnless(emp.propertyNamed('fkStore'))
+ self.failUnless(mark.propertyNamed('fkEmployee'))
self.failIf(emp.propertyNamed('toStore').deleteRule()!='nullify')
self.failIf(emp.propertyNamed('toMarks').deleteRule()!='cascade')
|
|
From: <sbi...@us...> - 2003-05-18 16:03:33
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees
In directory sc8-pr-cvs1:/tmp/cvs-serv22500/tests/testPackages/StoreEmployees
Modified Files:
Tag: brch-0_9pre7-1-PyModel
pymodel_StoreEmployees.py
Log Message:
Fixed modelization for Store <<---> Employee
Index: pymodel_StoreEmployees.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/Attic/pymodel_StoreEmployees.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** pymodel_StoreEmployees.py 18 May 2003 15:29:27 -0000 1.1.2.1
--- pymodel_StoreEmployees.py 18 May 2003 16:03:30 -0000 1.1.2.2
***************
*** 84,89 ****
relations=['toEmployee', 'toAddresses'],
keys=['fkEmployeeId', 'id']),
! Association('Store', 'Employee',
! relations=['employees', 'toStore'],
keys=['fkStoreId', 'id']),
]
--- 84,89 ----
relations=['toEmployee', 'toAddresses'],
keys=['fkEmployeeId', 'id']),
! Association('Employee', 'Store',
! relations=['toStore', 'employees'],
keys=['fkStoreId', 'id']),
]
|
|
From: <sbi...@us...> - 2003-05-18 16:02:23
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv21896
Modified Files:
Tag: brch-0_9pre7-1-PyModel
PyModel.py
Log Message:
Added PyModel.Model.toXML()
Index: PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attic/PyModel.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** PyModel.py 18 May 2003 15:23:25 -0000 1.1.2.2
--- PyModel.py 18 May 2003 16:02:20 -0000 1.1.2.3
***************
*** 226,229 ****
--- 226,239 ----
+ def toXML(self):
+ import cStringIO
+ _strIO=cStringIO.StringIO()
+ doc=self.component.getXMLDOM(encoding='iso-8859-1')
+ from xml.dom.ext import PrettyPrint
+ PrettyPrint(doc, stream=_strIO, encoding='iso-8859-1')
+ xml=_strIO.getvalue()
+ _strIO.close()
+ return xml
+
##
|
|
From: <sbi...@us...> - 2003-05-18 15:30:02
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv4858
Modified Files:
Tag: brch-0_9pre7-1-PyModel
CHANGES
Log Message:
Updated
Index: CHANGES
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v
retrieving revision 1.102.2.1
retrieving revision 1.102.2.2
diff -C2 -d -r1.102.2.1 -r1.102.2.2
*** CHANGES 18 May 2003 15:26:48 -0000 1.102.2.1
--- CHANGES 18 May 2003 15:29:59 -0000 1.102.2.2
***************
*** 11,15 ****
-----------------------------
! * Added Modeling.PyModel
* Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py
--- 11,15 ----
-----------------------------
! * Added Modeling.PyModel and Modeling.tests.test_PyModel
* Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py
|
|
From: <sbi...@us...> - 2003-05-18 15:29:30
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees
In directory sc8-pr-cvs1:/tmp/cvs-serv4394/tests/testPackages/StoreEmployees
Added Files:
Tag: brch-0_9pre7-1-PyModel
pymodel_StoreEmployees.py
Log Message:
Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py and
updated StoreEmployees/__init__.py: now loads the model from the
PyModel
--- NEW FILE: pymodel_StoreEmployees.py ---
#! /usr/bin/env python
'''
A sample Pythonic OO-RDB Model
(re-expressing testPackages/StoreEmployees/model_StoreEmployees.xml) --
A PyModel must define a global variable called 'model', that is of type Model
'''
from Modeling.PyModel import *
##
# Set preferred defaults for this model (when different from
# standard defaults, or if we want to make things explicit)
AFloat.defaults['precision'] = 10
AFloat.defaults['scale'] = 10
AString.defaults['width'] = 30
RToOne.defaults['delete'] = 'nullify'
RToOne.defaults['multiplicity'] = [0,1]
#RToOne.defaults['sourceAttribute'] = RToOne.attNameFromRel # 'fk'+destEnt+destAtt+count
#RToOne.defaults['destinationAttribute'] = 'id'
RToMany.defaults['delete'] = 'cascade'
RToMany.defaults['multiplicity'] = [0,None]
#RToMany.defaults['sourceAttribute'] = 'id'
#RToMany.defaults['destinationAttribute'] = RToMany.attNameFromRel # fk+destEnt+sourceAtt+count
# 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!')
]
##
_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'],
keys=['FK_Executive_id', 'id']),
Association('Address', 'Employee',
relations=['toEmployee', 'toAddresses'],
keys=['fkEmployeeId', 'id']),
Association('Store', 'Employee',
relations=['employees', 'toStore'],
keys=['fkStoreId', 'id']),
]
if __name__ == '__main__':
model.build()
#print model.validate()
#print model.toXML()
# plus whatever ...
##
|
|
From: <sbi...@us...> - 2003-05-18 15:28:18
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv3856/tests
Modified Files:
Tag: brch-0_9pre7-1-PyModel
test_PyModel.py
Log Message:
Added tests for Associations + now checks that relationships' properties (such as their delete rule) are correctly set
Index: test_PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/Attic/test_PyModel.py,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -d -r1.1.2.2 -r1.1.2.3
*** test_PyModel.py 18 May 2003 11:54:34 -0000 1.1.2.2
--- test_PyModel.py 18 May 2003 15:28:15 -0000 1.1.2.3
***************
*** 83,95 ****
# Check toStore and toMarks for Employee
toStore=emp.propertyNamed('toStore')
toMarks=emp.propertyNamed('toMarks')
check(self, toStore, toMarks, store, mark)
! self.failIf(emp.propertyNamed('fkStore') not in toStore.sourceAttributes())
self.failIf(store.propertyNamed('id') not in toStore.destinationAttributes())
self.failIf(emp.propertyNamed('id') not in toMarks.sourceAttributes())
self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
# Check toStore and toMarks for SalesClerk
toStore=sc.propertyNamed('toStore')
toMarks=sc.propertyNamed('toMarks')
check(self, toStore, toMarks, store, mark)
--- 83,98 ----
# Check toStore and toMarks for Employee
toStore=emp.propertyNamed('toStore')
+ fkStore=emp.propertyNamed('fkStore')
toMarks=emp.propertyNamed('toMarks')
check(self, toStore, toMarks, store, mark)
! self.failIf(fkStore not in toStore.sourceAttributes())
self.failIf(store.propertyNamed('id') not in toStore.destinationAttributes())
self.failIf(emp.propertyNamed('id') not in toMarks.sourceAttributes())
self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
+ self.failIf(fkStore.isRequired()!=toStore.multiplicityLowerBound())
# Check toStore and toMarks for SalesClerk
toStore=sc.propertyNamed('toStore')
+ fkStore=sc.propertyNamed('fkStore')
toMarks=sc.propertyNamed('toMarks')
check(self, toStore, toMarks, store, mark)
***************
*** 98,101 ****
--- 101,105 ----
self.failIf(sc.propertyNamed('id') not in toMarks.sourceAttributes())
self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
+ self.failIf(fkStore.isRequired()!=toStore.multiplicityLowerBound())
def check_inverse_rels(self, model):
***************
*** 108,114 ****
store=model.component.entityNamed('Store')
mark=model.component.entityNamed('Mark')
self.failUnless(mark.relationshipNamed('toEmployee').inverseRelationship()==emp.propertyNamed('toMarks'))
self.failUnless(store.relationshipNamed('toEmployees').inverseRelationship()==emp.propertyNamed('toStore'))
!
## BEGIN tests
def setUp(self):
--- 112,122 ----
store=model.component.entityNamed('Store')
mark=model.component.entityNamed('Mark')
+
self.failUnless(mark.relationshipNamed('toEmployee').inverseRelationship()==emp.propertyNamed('toMarks'))
self.failUnless(store.relationshipNamed('toEmployees').inverseRelationship()==emp.propertyNamed('toStore'))
!
! toEmployee=mark.relationshipNamed('toEmployee')
! self.failIf(mark.propertyNamed('fkEmployee').isRequired()!=toEmployee.multiplicityLowerBound())
!
## BEGIN tests
def setUp(self):
***************
*** 207,212 ****
Entity('Employee',
properties=[ AForeignKey('fkStore'),
! RToOne('toStore', 'Store',src='fkStore',dst='id'),
! RToMany('toMarks', 'Mark',src='id',dst='fkEmployee'),
] ),
Entity('SalesClerk', parent='Employee'),
--- 215,222 ----
Entity('Employee',
properties=[ AForeignKey('fkStore'),
! RToOne('toStore', 'Store',src='fkStore',dst='id',
! delete='deny'),
! RToMany('toMarks', 'Mark',src='id',dst='fkEmployee',
! delete='cascade'),
] ),
Entity('SalesClerk', parent='Employee'),
***************
*** 216,219 ****
--- 226,231 ----
model.build()
self.check_model(model)
+ self.failIf(model.component.entityNamed('Employee').propertyNamed('toStore').deleteRule()!='deny')
+ self.failIf(model.component.entityNamed('Employee').propertyNamed('toMarks').deleteRule()!='cascade')
def test_05_unqualified_relationships_no_inverse(self):
***************
*** 354,357 ****
--- 366,403 ----
self.check_inverse_rels(self.model)
#
+ self.setUp()
+ model=self.model
+ model.entities = [
+ Entity('Employee'),
+ Entity('SalesClerk', parent='Employee'),
+ Entity('Mark'),
+ Entity('Store'),
+ ]
+ model.associations = [
+ Association('Employee', 'Store',
+ relations=['toStore', 'toEmployees'],
+ multiplicity=[ [1, 1], [0, None] ],
+ keys=['fkStore', 'id'],
+ delete=['nullify', 'deny'],
+ ),
+ Association('Mark', 'Employee',
+ relations=['toEmployee', 'toMarks'],
+ multiplicity=[ [1, 1], [0, None] ],
+ keys=['fkEmployee', 'id'],
+ delete=['nullify', 'cascade']
+ ),
+ ]
+ model.build()
+ self.check_model(model)
+ self.check_inverse_rels(model)
+ # check that delete rules were correctly set
+ emp=model.component.entityNamed('Employee')
+ mark=model.component.entityNamed('Mark')
+ store=model.component.entityNamed('Store')
+
+ self.failIf(emp.propertyNamed('toStore').deleteRule()!='nullify')
+ self.failIf(emp.propertyNamed('toMarks').deleteRule()!='cascade')
+ self.failIf(store.propertyNamed('toEmployees').deleteRule()!='deny')
+ self.failIf(mark.propertyNamed('toEmployee').deleteRule()!='nullify')
def test_suite():
|
|
From: <sbi...@us...> - 2003-05-18 15:26:50
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv3302
Modified Files:
Tag: brch-0_9pre7-1-PyModel
CHANGES
Log Message:
Updated CHANGES for brch
Index: CHANGES
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/CHANGES,v
retrieving revision 1.102
retrieving revision 1.102.2.1
diff -C2 -d -r1.102 -r1.102.2.1
*** CHANGES 10 May 2003 17:38:24 -0000 1.102
--- CHANGES 18 May 2003 15:26:48 -0000 1.102.2.1
***************
*** 8,15 ****
--------------------------------------------------------
! * RFE #726839: Added environment variable MDL_DB_CONNECTIONS_CFG; it points
! to a single ini-file which centralizes the sensitive informations
! contained in each model's database connection dictionary (username,
! password). See tests/Postgresql.cfg for an example.
0.9-pre-7.1 (2003/05/08)
--- 8,25 ----
--------------------------------------------------------
! Branch brch-0_9pre7-1-PyModel
! -----------------------------
!
! * Added Modeling.PyModel
!
! * Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py
! and updated StoreEmployees/__init__.py: now loads the model from the
! PyModel
!
! * Changed ClassDescription's delete rules: constants DELETE_CASCADE,
! DELETE_DENY, DELETE_NULLIFY and DELETE_NOACTION are now strings (were:
! integers)
! --> Relationship.setDeleteRule() updated to accept old integer values
! (backward compatibility)
0.9-pre-7.1 (2003/05/08)
|
|
From: <sbi...@us...> - 2003-05-18 15:26:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees
In directory sc8-pr-cvs1:/tmp/cvs-serv3109/tests/testPackages/StoreEmployees
Modified Files:
Tag: brch-0_9pre7-1-PyModel
__init__.py
Log Message:
Added tests/testPackages/StoreEmployees/pymodel_StoreEmployees.py and
updated StoreEmployees/__init__.py: now loads the model from the
PyModel
Index: __init__.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/testPackages/StoreEmployees/__init__.py,v
retrieving revision 1.2
retrieving revision 1.2.4.1
diff -C2 -d -r1.2 -r1.2.4.1
*** __init__.py 21 Aug 2002 18:40:17 -0000 1.2
--- __init__.py 18 May 2003 15:26:25 -0000 1.2.4.1
***************
*** 3,10 ****
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:
--- 3,25 ----
from Modeling import ModelSet
import os, warnings, StringIO, traceback
!
try:
if ModelSet.defaultModelSet().modelNamed("StoreEmployees") is None:
+ from pymodel_StoreEmployees import model
+ model.build()
+ ModelSet.defaultModelSet().addModel(model.component)
+ model=ModelSet.defaultModelSet().modelNamed('StoreEmployees')
+ except:
+ exc=StringIO.StringIO()
+ traceback.print_exc(file=exc)
+ warnings.warn("Couldn't load model from pymodel_StoreEmployee.py\nReason:\n%s"%exc.getvalue())
+ del exc
+
+
+ try:
+ if ModelSet.defaultModelSet().modelNamed("StoreEmployees") is None:
+ from model_StoreEmployees import model_src
ModelSet.defaultModelSet().addModelFromXML({'string': model_src})
+ del model_src
model=ModelSet.defaultModelSet().modelNamed('StoreEmployees')
except:
***************
*** 14,18 ****
del exc
! del os, warnings, StringIO, traceback, model_src
# Or, alternatively: use the xml file (ok for dev. mode, not for install w/
--- 29,33 ----
del exc
! del os, warnings, StringIO, traceback
# Or, alternatively: use the xml file (ok for dev. mode, not for install w/
|
|
From: <sbi...@us...> - 2003-05-18 15:25:12
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv2441
Modified Files:
Tag: brch-0_9pre7-1-PyModel
ClassDescription.py Relationship.py
Log Message:
Changed ClassDescription's delete rules: constants DELETE_CASCADE,
DELETE_DENY, DELETE_NULLIFY and DELETE_NOACTION are now strings (were:
integers)
--> Relationship.setDeleteRule() updated to accept old integer values
(backward compatibility)
Index: ClassDescription.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ClassDescription.py,v
retrieving revision 1.9
retrieving revision 1.9.6.1
diff -C2 -d -r1.9 -r1.9.6.1
*** ClassDescription.py 10 Jan 2003 10:45:44 -0000 1.9
--- ClassDescription.py 18 May 2003 15:25:09 -0000 1.9.6.1
***************
*** 54,62 ****
# Integer constants
! DELETE_NULLIFY=0
! DELETE_DENY=1
! DELETE_CASCADE=2
! DELETE_NOACTION=3 # careful here...
# Notification
ClassDescriptionNeededForEntityNameNotification='ClassDescriptionNeededForEntityName'
--- 54,68 ----
# Integer constants
! DELETE_NULLIFY='nullify'
! DELETE_DENY='deny'
! DELETE_CASCADE='cascade'
! DELETE_NOACTION='noaction' # careful here...
+ # For backward compatibility
+ old_delete_rules= { 0: DELETE_NULLIFY,
+ 1: DELETE_DENY,
+ 2: DELETE_CASCADE,
+ 3: DELETE_NOACTION,
+ }
# Notification
ClassDescriptionNeededForEntityNameNotification='ClassDescriptionNeededForEntityName'
Index: Relationship.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -C2 -d -r1.8.2.2 -r1.8.2.3
*** Relationship.py 18 May 2003 13:49:35 -0000 1.8.2.2
--- Relationship.py 18 May 2003 15:25:09 -0000 1.8.2.3
***************
*** 50,54 ****
# Relationships props
! from EntityClassDescription import DELETE_NULLIFY, DELETE_DENY, DELETE_CASCADE
from utils import isListOrTuple
--- 50,54 ----
# Relationships props
! from ClassDescription import DELETE_NULLIFY, DELETE_DENY, DELETE_CASCADE, DELETE_NOACTION, old_delete_rules
from utils import isListOrTuple
***************
*** 67,71 ****
class Relationship(Persistent, XMLCapability, KeyValueCoding):
"See interfaces.Relationship for detail"
-
#
_isClassProperty=1
--- 67,70 ----
***************
*** 162,171 ****
DELETE_NULLIFY, DELETE_CASCADE and DELETE_DENY
"""
if rule not in (DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY):
raise ValueError, \
! ("Parameter 'rule' should be one of DELETE_NULLIFY (%i), "+\
! "DELETE_CASCADE (%i) or DELETE_DENY (%i)") \
! % (DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY)
! rule=int(rule)
self._deleteRule=rule
--- 161,173 ----
DELETE_NULLIFY, DELETE_CASCADE and DELETE_DENY
"""
+ #backward compatibility
+ if type(rule) in (type(0), type(0L), type(0.0)) or\
+ rule in ('0', '1', '2', '3'):
+ rule=old_delete_rules.get(int(rule), rule)
if rule not in (DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY):
raise ValueError, \
! ("Parameter 'rule' (%s) should be one of DELETE_NULLIFY (%s), "+\
! "DELETE_CASCADE (%s) or DELETE_DENY (%s)") \
! % (rule, DELETE_NULLIFY, DELETE_CASCADE, DELETE_DENY)
self._deleteRule=rule
***************
*** 297,301 ****
lambda self=None,p=None: None,
self.name),
! 'deleteRule' : ('number',
self.setDeleteRule,
self.deleteRule),
--- 299,303 ----
lambda self=None,p=None: None,
self.name),
! 'deleteRule' : ('string',
self.setDeleteRule,
self.deleteRule),
|
|
From: <sbi...@us...> - 2003-05-18 15:23:28
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv1779
Modified Files:
Tag: brch-0_9pre7-1-PyModel
PyModel.py
Log Message:
Full implementation for Association (version 1)
Index: PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attic/PyModel.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** PyModel.py 15 May 2003 17:44:58 -0000 1.1.2.1
--- PyModel.py 18 May 2003 15:23:25 -0000 1.1.2.2
***************
*** 61,65 ****
def debug(msg):
! print msg
def error(msg):
--- 61,66 ----
def debug(msg):
! #print msg
! pass
def error(msg):
***************
*** 186,190 ****
entities.remove(entity)
while entities:
! print [e.name for e in entities], entities_processed
es=[e for e in entities if e.parent in entities_processed]
for entity in es:
--- 187,191 ----
entities.remove(entity)
while entities:
! #print [e.name for e in entities], entities_processed
es=[e for e in entities if e.parent in entities_processed]
for entity in es:
***************
*** 317,321 ****
if isinstance(prop, APrimaryKey):
return prop
! return 0
def propagate_attribute(self, attributeDescObj, model):
--- 318,322 ----
if isinstance(prop, APrimaryKey):
return prop
! return None
def propagate_attribute(self, attributeDescObj, model):
***************
*** 586,590 ****
class BaseRelation(BaseDescription):
''' Describes a Relation '''
! defaults={ 'delete': 0,
#'key': 0,
#'destinationEntity': '',
--- 587,591 ----
class BaseRelation(BaseDescription):
''' Describes a Relation '''
! defaults={ 'delete': 0, # nullify
#'key': 0,
#'destinationEntity': '',
***************
*** 623,629 ****
class RToOne(BaseRelation):
! defaults={ 'multiplicity': [0,1],
! 'joinSemantic': 0,
! }
propagated_by=None
--- 624,631 ----
class RToOne(BaseRelation):
! defaults=BaseRelation.defaults.copy()
! defaults.update({ 'multiplicity': [0,1],
! 'joinSemantic': 0,
! })
propagated_by=None
***************
*** 693,699 ****
class RToMany(BaseRelation):
! defaults={ 'multiplicity': [0,None],
! 'joinSemantic': 0,
! }
propagated_by=None
--- 695,702 ----
class RToMany(BaseRelation):
! defaults=BaseRelation.defaults.copy()
! defaults.update({ 'multiplicity': [0,None],
! 'joinSemantic': 0,
! })
propagated_by=None
***************
*** 765,793 ****
class Association(BaseDescription):
! ''' Describes a Relation between 2 entities '''
! # TBD a placer dans les prop. de Entity
! # ex. Relation('Employee', 'Address', ([0,None],cascade), ([0,1],deny))
! # --> soit ca
! # --> soit tout a la main
! # --> soit dans les Entity, RToOne, RToMany:
! # - avec seulement destEntity
! # - avec destEntity et inverse=
! def __init__(self, src, dst,
! multiplicity=[0,1], invMultiplicity=[0,None],
! srcProps={}, dstProps={}):
! if multiplicity[1]>1:
! raise ValueError, 'invalid mult'
! if not (invMultiplicity[1] in (None, '*', -1) or invMultiplicity[0]>1):
! raise ValueError, 'invalid invMult'
! self.src=src
! self.dst=dst
## TBD 1: inverser src/dst si multiplicities sont inversees
## TBD 2: possibilite d'ajout des srcKey/dstKey
! self.multiplicity=multiplicity
! self.invMultiplicity=invMultiplicity
! self.srcProps=srcProps
! self.dstProps=dstProps
!
def build(self, model):
srcE=model.entityNamed(self.src)
--- 768,824 ----
+ def relationsForSrcAndDst(src,dst):
+ return ('to'+dst, 'to'+src+'s')
+
class Association(BaseDescription):
! '''
! Describes an Association between 2 entities
!
! An Association binds two entities, 'src' and 'dst' (cf. __init__()),
! with two relationships:
!
! - a toOne relationship src -> dst
!
! - a toMany relationship dst -> src
!
! '''
! defaults = { 'multiplicity': [ [0,1], [0,None] ],
! 'relations': MP(relationsForSrcAndDst, 'src', 'dst'),
! 'keys': [ None, None ],
! 'delete': [ RToOne.defaults['delete'],
! RToMany.defaults['delete'] ],
! 'isClassProperty': [ RToOne.defaults['isClassProperty'],
! RToMany.defaults['isClassProperty'] ],
! 'joinSemantic': [ RToOne.defaults['joinSemantic'],
! RToMany.defaults['joinSemantic'] ],
! 'displayLabel': [ RToOne.defaults['displayLabel'],
! RToMany.defaults['displayLabel'] ],
! 'doc': [ RToOne.defaults['doc'],
! RToMany.defaults['doc'] ],
! }
!
! def __init__(self, src, dst, **kw):
! self.src=kw['src']=src
! self.dst=kw['dst']=dst
! updateComponent(self,kw,Association.defaults,
! name='Association(%s,%s)'%(src, dst))
! self.check_multiplicity()
!
! def check_multiplicity(self):
! """
! Check the self.multiplicity is correct
!
! Returns: (src->dst multiplicity, dst->src multiplicity)
! """
## TBD 1: inverser src/dst si multiplicities sont inversees
## TBD 2: possibilite d'ajout des srcKey/dstKey
! sd_mult=self.multiplicity[0]
! ds_mult=self.multiplicity[1]
! if sd_mult[1]>1:
! raise ValueError, 'invalid multiplicity src->dst: should be toOne'
! if not (ds_mult[1] in (None, '*', -1) or ds_mult[0]>1):
! raise ValueError, 'invalid multiplicity dst->src: should be toMany'
! return sd_mult, ds_mult
!
def build(self, model):
srcE=model.entityNamed(self.src)
***************
*** 797,816 ****
if not dstE:
raise ValueError, 'Association: Unable to find destination entity %s'%self.dst
- dstAtt=dstE.primaryKey()
- if not dstAtt:
- dstAtt=APrimaryKey()
- dstE.properties.append(srcAtt)
- # FK: create it (TBD: unless ajout dstKey cf __init__)
- srcAtt=AForeignKey(srcE.attFKName(dstE.name))
- srcE.properties.append(srcAtt)
! # Relationships
! srcRelName='to'+dstE.name # TBD: build it appropriately!
! dstRelName='to'+srcE.name+'s' # TBD: build it appropriately!
! srcRel=RToOne(srcRelName, dstE.name, ## TBD: +properties
! src=srcAtt.name, dst=dstAtt.name)
! dstRel=RToMany(dstRelName, srcE.name, ## TBD: +properties
! src=dstAtt.name, dst=srcAtt.name)
srcE.properties.append(srcRel)
dstE.properties.append(dstRel)
--- 828,875 ----
if not dstE:
raise ValueError, 'Association: Unable to find destination entity %s'%self.dst
! ## PK
! dstE_pk=dstE.primaryKey()
! if not self.keys[1]: # unspecified: retrieve it
! if not dstE_pk:
! raise ValueError, '%s: Unable to find a PK in entity %s'%(self.name, self.dst)
! dstAtt=dstE_pk
! self.keys[1]=dstAtt.name
!
! else: # destination PK was specified
! if dstE_pk and dstE_pk.name != self.keys[1]:
! raise ValueError, '%s: specifies a destination attribute %s for entity %s for this entity already has a PK named %s'%(self.name,self.keys[1],self.dst,dstE_pk.name)
!
! dstAtt=dstE.attributeNamed(self.keys[1])
! if not dstAtt:
! debug('Creating default PK in %s'%self.dst)
! dstAtt=APrimaryKey()
! dstE.properties.append(dstAtt)
! ## FK
! srcAtt=srcE.attributeNamed(self.keys[0])
! if not srcAtt:
! if not self.keys[0]:
! self.keys[0]=srcE.attFKName(dstE.name)
! debug('%s: Creating FK %s.%s'%(self.name, self.src, self.keys[0]))
! srcAtt=AForeignKey(self.keys[0])
! srcE.properties.append(srcAtt)
!
! ## Now srcAtt and dstAtt are set
!
! # Relationships
! toOne_kw={} ; toMany_kw={}
! for k in ('delete','isClassProperty','joinSemantic','displayLabel','doc'):
! toOne_kw[k]=getattr(self, k)[0]
! toMany_kw[k]=getattr(self, k)[1]
! toOne_kw['src']=srcAtt.name ; toOne_kw['dst']=dstAtt.name
! toMany_kw['src']=dstAtt.name ; toMany_kw['dst']=srcAtt.name
!
! #srcRel=RToOne(self.relations[0], dstE.name, ## TBD: +properties
! # src=srcAtt.name, dst=dstAtt.name)
! srcRel=apply(RToOne, (self.relations[0], dstE.name), toOne_kw)
! #dstRel=RToMany(self.relations[1], srcE.name, ## TBD: +properties
! # src=dstAtt.name, dst=srcAtt.name)
! dstRel=apply(RToMany, (self.relations[1], srcE.name), toMany_kw)
srcE.properties.append(srcRel)
dstE.properties.append(dstRel)
***************
*** 865,873 ****
l=[kw[n] for n in v.param]
v=apply(v.method, l)
else:
v=copy(v)
! #try: print k, ': ', v
! #except: import pdb ; pdb.set_trace()
! object.component.takeStoredValueForKey(v,k)
##
--- 924,933 ----
l=[kw[n] for n in v.param]
v=apply(v.method, l)
+ setattr(object, k, v)
else:
v=copy(v)
! if hasattr(object, 'component'):
! # Associations do not have any 'component'
! object.component.takeStoredValueForKey(v,k)
##
|
|
From: <sbi...@us...> - 2003-05-18 13:49:38
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv29229
Modified Files:
Tag: brch-0_9pre7-1-PyModel
Relationship.py
Log Message:
Removed a useless print statement (initially added for debugging pruposes)
Index: Relationship.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v
retrieving revision 1.8.2.1
retrieving revision 1.8.2.2
diff -C2 -d -r1.8.2.1 -r1.8.2.2
*** Relationship.py 15 May 2003 17:44:20 -0000 1.8.2.1
--- Relationship.py 18 May 2003 13:49:35 -0000 1.8.2.2
***************
*** 340,344 ****
self._propagatesPK = 0
self._ownsDestination = 0
- print 'RELATIONSHIP INIT %s'%aName
return
--- 340,343 ----
***************
*** 809,813 ****
def handleAssignementForUnboundKey(self, value, key):
if key=='doc': self.setComment(value)
! elif key=='delete': self.setDeleteRule(value)
else:
raise AttributeError, key
--- 808,813 ----
def handleAssignementForUnboundKey(self, value, key):
if key=='doc': self.setComment(value)
! elif key=='delete':
! self.setDeleteRule(value)
else:
raise AttributeError, key
|
|
From: <sbi...@us...> - 2003-05-18 11:54:38
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/tests
In directory sc8-pr-cvs1:/tmp/cvs-serv11619
Modified Files:
Tag: brch-0_9pre7-1-PyModel
test_PyModel.py
Log Message:
Reorganized the tests --factorization of tests in check_model() and check_inverse_rels()
Index: test_PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/tests/Attic/test_PyModel.py,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -C2 -d -r1.1.2.1 -r1.1.2.2
*** test_PyModel.py 15 May 2003 17:44:58 -0000 1.1.2.1
--- test_PyModel.py 18 May 2003 11:54:34 -0000 1.1.2.2
***************
*** 52,56 ****
--- 52,115 ----
self.failUnless(r.destinationEntity(),'%s.%s.destinationEntity() is None'%(e.name(),r.name()))
+
+ def check_model(self, model):
+ """
+ This method tests that:
+
+ - checkEntitiesProperties() succeeds,
+
+ - SalesClerk has 2 relationships,
+
+ - for Employee and SalesClerk, relationships 'toStore' and 'toMarks'
+ have the correct multiplicity, that their source and destination
+ attributes are correct, and that their destination entities are correct
+
+ """
+ emp=model.component.entityNamed('Employee')
+ sc=model.component.entityNamed('SalesClerk')
+ store=model.component.entityNamed('Store')
+ mark=model.component.entityNamed('Mark')
+
+ self.checkEntitiesProperties((emp,sc,store,mark))
+
+ self.assertEqual(len(sc.relationships()), 2)
+
+ def check(self, toStore, toMarks, store, mark):
+ self.failUnless(toStore.isToOne())
+ self.failUnless(toMarks.isToMany())
+ self.assertEqual(toStore.destinationEntity(), store)
+ self.assertEqual(toMarks.destinationEntity(), mark)
+
+ # Check toStore and toMarks for Employee
+ toStore=emp.propertyNamed('toStore')
+ toMarks=emp.propertyNamed('toMarks')
+ check(self, toStore, toMarks, store, mark)
+ self.failIf(emp.propertyNamed('fkStore') not in toStore.sourceAttributes())
+ self.failIf(store.propertyNamed('id') not in toStore.destinationAttributes())
+ self.failIf(emp.propertyNamed('id') not in toMarks.sourceAttributes())
+ self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
+
+ # Check toStore and toMarks for SalesClerk
+ toStore=sc.propertyNamed('toStore')
+ toMarks=sc.propertyNamed('toMarks')
+ check(self, toStore, toMarks, store, mark)
+ self.failIf(sc.propertyNamed('fkStore') not in toStore.sourceAttributes())
+ self.failIf(store.propertyNamed('id') not in toStore.destinationAttributes())
+ self.failIf(sc.propertyNamed('id') not in toMarks.sourceAttributes())
+ self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
+
+ def check_inverse_rels(self, model):
+ """
+ This method checks that Employee.toStore (resp. Employee.toMarks) is the
+ inverse relationship for Store.toEmployees (resp. Mark.toEmployee)
+ """
+ emp=model.component.entityNamed('Employee')
+ sc=model.component.entityNamed('SalesClerk')
+ store=model.component.entityNamed('Store')
+ mark=model.component.entityNamed('Mark')
+ self.failUnless(mark.relationshipNamed('toEmployee').inverseRelationship()==emp.propertyNamed('toMarks'))
+ self.failUnless(store.relationshipNamed('toEmployees').inverseRelationship()==emp.propertyNamed('toStore'))
+ ## BEGIN tests
def setUp(self):
self.model = Model('StoreEmployees',adaptorName='Postgresql')
***************
*** 156,181 ****
]
model.build()
! emp=model.component.entityNamed('Employee')
! sc=model.component.entityNamed('SalesClerk')
! store=model.component.entityNamed('Store')
! mark=model.component.entityNamed('Mark')
!
! self.checkEntitiesProperties((emp,sc,store,mark))
!
! self.assertEqual(len(sc.relationships()), 2)
!
! def check(self, toStore, toMarks, store, mark):
! self.failUnless(toStore.isToOne())
! self.failUnless(toMarks.isToMany())
! self.assertEqual(toStore.destinationEntity(), store)
! self.assertEqual(toMarks.destinationEntity(), mark)
!
! toStore=emp.propertyNamed('toStore')
! toMarks=emp.propertyNamed('toMarks')
! check(self, toStore, toMarks, store, mark)
!
! toStore=sc.propertyNamed('toStore')
! toMarks=sc.propertyNamed('toMarks')
! check(self, toStore, toMarks, store, mark)
def test_05_unqualified_relationships_no_inverse(self):
--- 215,219 ----
]
model.build()
! self.check_model(model)
def test_05_unqualified_relationships_no_inverse(self):
***************
*** 193,196 ****
--- 231,236 ----
]
model.build()
+ self.check_model(model)
+
emp=model.component.entityNamed('Employee')
sc=model.component.entityNamed('SalesClerk')
***************
*** 198,202 ****
mark=model.component.entityNamed('Mark')
- self.checkEntitiesProperties((emp,sc,store,mark))
self.assertEqual(len(sc.relationships()), 2)
--- 238,241 ----
***************
*** 211,238 ****
self.failUnless(sc.attributeNamed('fkStore'))
self.failUnless(mark.attributeNamed('fkEmployee'))
-
- def check(self, toStore, toMarks, store, mark):
- self.failUnless(toStore.isToOne())
- self.failUnless(toMarks.isToMany())
- self.assertEqual(toStore.destinationEntity(), store)
- self.assertEqual(toMarks.destinationEntity(), mark)
-
- # check the parent
- toStore=emp.propertyNamed('toStore')
- toMarks=emp.propertyNamed('toMarks')
- check(self, toStore, toMarks, store, mark)
- self.failIf(emp.propertyNamed('fkStore') not in toStore.sourceAttributes())
- self.failIf(store.propertyNamed('id') not in toStore.destinationAttributes())
- self.failIf(emp.propertyNamed('id') not in toMarks.sourceAttributes())
- self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
-
- # Also check the sub-entity
- toStore=sc.propertyNamed('toStore')
- toMarks=sc.propertyNamed('toMarks')
- check(self, toStore, toMarks, store, mark)
- self.failIf(sc.propertyNamed('fkStore') not in toStore.sourceAttributes())
- self.failIf(store.propertyNamed('id') not in toStore.destinationAttributes())
- self.failIf(sc.propertyNamed('id') not in toMarks.sourceAttributes())
- self.failIf(mark.propertyNamed('fkEmployee') not in toMarks.destinationAttributes())
# test_06 qualified & unqualified
--- 250,253 ----
***************
*** 256,292 ****
# # NB: quid si inverse='ghjgh'? --> TBD test!
# ]
-
- def check_model(self, model):
- model.build()
- emp=model.component.entityNamed('Employee')
- sc=model.component.entityNamed('SalesClerk')
- store=model.component.entityNamed('Store')
- mark=model.component.entityNamed('Mark')
-
- self.checkEntitiesProperties((emp,sc,store,mark))
-
- self.assertEqual(len(sc.relationships()), 2)
-
- def check(self, toStore, toMarks, store, mark):
- self.failUnless(toStore.isToOne())
- self.failUnless(toMarks.isToMany())
- self.assertEqual(toStore.destinationEntity(), store)
- self.assertEqual(toMarks.destinationEntity(), mark)
-
- toStore=emp.propertyNamed('toStore')
- toMarks=emp.propertyNamed('toMarks')
- check(self, toStore, toMarks, store, mark)
-
- toStore=sc.propertyNamed('toStore')
- toMarks=sc.propertyNamed('toMarks')
- check(self, toStore, toMarks, store, mark)
- #### JUSQU'ICI on est pareil que test_04
- self.failUnless(mark.relationshipNamed('toEmployee').inverseRelationship()==emp.propertyNamed('toMarks'))
- self.failUnless(store.relationshipNamed('toEmployees').inverseRelationship()==emp.propertyNamed('toStore'))
def test_07_relationships_with_inverse(self):
"[PyModel] qualified_relationships_with_inverse"
! model = self.model
! model.entities = [
Entity('Employee',
properties=[ AForeignKey('fkStore'),
--- 271,278 ----
# # NB: quid si inverse='ghjgh'? --> TBD test!
# ]
def test_07_relationships_with_inverse(self):
"[PyModel] qualified_relationships_with_inverse"
! self.model.entities = [
Entity('Employee',
properties=[ AForeignKey('fkStore'),
***************
*** 307,312 ****
# NB: quid si inverse='ghjgh'? --> TBD test!
]
self.check_model(self.model)
!
#
self.setUp()
--- 293,299 ----
# NB: quid si inverse='ghjgh'? --> TBD test!
]
+ self.model.build()
self.check_model(self.model)
! self.check_inverse_rels(self.model)
#
self.setUp()
***************
*** 324,330 ****
--- 311,321 ----
),
]
+ self.model.build()
self.check_model(self.model)
+ self.check_inverse_rels(self.model)
# Automatic creation of source + destination key
+ # NOTE: this fails by now, because the feature is considered not desirable
+ # for now.
self.setUp()
self.model.entities = [
***************
*** 341,349 ****
),
]
#self.check_model(self.model)
!
def test_08_qualified_relationships_with_inverse(self):
"[PyModel] unqualified_relationships_with_inverse"
model = self.model
model.entities = [
--- 332,342 ----
),
]
+ #self.model.build()
#self.check_model(self.model)
! #self.check_inverse_rels(self.model)
def test_08_qualified_relationships_with_inverse(self):
"[PyModel] unqualified_relationships_with_inverse"
+ # Simple declaration
model = self.model
model.entities = [
***************
*** 357,365 ****
Association('Mark', 'Employee'),
]
self.check_model(self.model)
def test_suite():
suite = unittest.TestSuite()
! suite.addTest(unittest.makeSuite(TestPyModel, "test_08"))
return suite
--- 350,361 ----
Association('Mark', 'Employee'),
]
+ model.build()
self.check_model(self.model)
+ self.check_inverse_rels(self.model)
+ #
def test_suite():
suite = unittest.TestSuite()
! suite.addTest(unittest.makeSuite(TestPyModel, "test_"))
return suite
|