[Modeling-cvs] ProjectModeling/Modeling PyModel.py,1.1.2.5,1.1.2.6
Status: Abandoned
Brought to you by:
sbigaret
|
From: <sbi...@us...> - 2003-06-28 15:32:30
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv10846
Modified Files:
Tag: brch-0_9pre7-1-PyModel
PyModel.py
Log Message:
Changed defaults for usedForLocking & Attributes. An association can now declare only one relationship (unidirectional association)
Index: PyModel.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attic/PyModel.py,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** PyModel.py 19 May 2003 10:39:26 -0000 1.1.2.5
--- PyModel.py 28 Jun 2003 15:32:27 -0000 1.1.2.6
***************
*** 524,527 ****
--- 524,528 ----
'externalType': 'INTEGER',
'defaultValue': 0,
+ 'usedForLocking': 1,
}
def __init__(self, name, **kw):
***************
*** 535,538 ****
--- 536,540 ----
'width': 255,
'defaultValue': '',
+ 'usedForLocking': 1,
}
def __init__(self, name, **kw):
***************
*** 551,554 ****
--- 553,557 ----
'scale': 5,
'defaultValue': 0.0,
+ 'usedForLocking': 1,
}
def __init__(self, name, **kw):
***************
*** 561,564 ****
--- 564,568 ----
'externalType': 'TIMESTAMP',
'defaultValue': None,
+ 'usedForLocking': 1,
}
def __init__(self, name, **kw):
***************
*** 573,576 ****
--- 577,581 ----
'isClassProperty'),
'doc': 'Primary Key',
+ 'usedForLocking': 0,
}
def __init__(self, name='id', **kw):
***************
*** 585,588 ****
--- 590,594 ----
'defaultValue': None,
'doc': 'Foreign Key',
+ 'usedForLocking': 0,
}
def __init__(self, name='id', **kw):
***************
*** 833,841 ****
def build(self, model):
srcE=model.entityNamed(self.src)
if not srcE:
! raise ValueError, 'Association: Unable to find source entity %s'%self.src
dstE=model.entityNamed(self.dst)
if not dstE:
! raise ValueError, 'Association: Unable to find destination entity %s'%self.dst
## PK
--- 839,851 ----
def build(self, model):
srcE=model.entityNamed(self.src)
+ myName="Association %s.%s"%(srcE.name,self.name)
if not srcE:
! raise ValueError, '%s: Unable to find source entity %s'%(my_name,self.src)
dstE=model.entityNamed(self.dst)
if not dstE:
! raise ValueError, '%s: Unable to find destination entity %s'%(my_name,self.dst)
!
! if not (self.relations[0] or self.relations[1]):
! raise ValueError, '%s: no relation defined'%my_name
## PK
***************
*** 849,853 ****
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])
--- 859,863 ----
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 but this entity already has a PK named %s'%(self.name,self.keys[1],self.dst,dstE_pk.name)
dstAtt=dstE.attributeNamed(self.keys[1])
***************
*** 878,887 ****
#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)
##
--- 888,899 ----
#srcRel=RToOne(self.relations[0], dstE.name, ## TBD: +properties
# src=srcAtt.name, dst=dstAtt.name)
! if self.relations[0]:
! srcRel=apply(RToOne, (self.relations[0], dstE.name), toOne_kw)
! srcE.properties.append(srcRel)
#dstRel=RToMany(self.relations[1], srcE.name, ## TBD: +properties
# src=dstAtt.name, dst=srcAtt.name)
! if self.relations[1]:
! dstRel=apply(RToMany, (self.relations[1], srcE.name), toMany_kw)
! dstE.properties.append(dstRel)
##
|