[Modeling-cvs] ProjectModeling/Modeling Relationship.py,1.15,1.16
Status: Abandoned
Brought to you by:
sbigaret
|
From: <sbi...@us...> - 2004-01-20 15:55:16
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv27096/Modeling
Modified Files:
Relationship.py
Log Message:
* Relationship.py: added __ne__ (for python 2.1 and 2.2), fixed
FlattenedRelationship.__eq__
* Fixed bug #862182: Validation refusing valid relations between objects
(TODO: tests units for this)
Index: Relationship.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Relationship.py 28 Jul 2003 07:18:59 -0000 1.15
--- Relationship.py 20 Jan 2004 15:55:13 -0000 1.16
***************
*** 239,244 ****
self._entity = anEntity
_setSourceEntity = setEntity #Compatibility w/ old API,_TBD should be removed
!
!
# XMLCapabilityInterface
def initWithXMLDOMNode(self, aNode, encoding='iso-8859-1'):
--- 239,248 ----
self._entity = anEntity
_setSourceEntity = setEntity #Compatibility w/ old API,_TBD should be removed
!
! # special
! def __ne__(self, aRelationship):
! # See test_Relationship.test_00_equality_n_inequality() for details
! return not self.__eq__(aRelationship)
!
# XMLCapabilityInterface
def initWithXMLDOMNode(self, aNode, encoding='iso-8859-1'):
***************
*** 740,748 ****
# values refer to the correct entity?
_values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement)
for _value in _values:
try:
if _value.isFault(): continue
- validNames=[self.destinationEntity().name()]
- validNames+=[e.name() for e in self.destinationEntity().subEntities()]
if _value.entityName() not in validNames:
_error.addErrorForKey(Validation.TYPE_MISMATCH, self.name())
--- 744,752 ----
# values refer to the correct entity?
_values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement)
+ validNames=[self.destinationEntity().name()]
+ validNames+=self.destinationEntity().allSubEntitiesNames()
for _value in _values:
try:
if _value.isFault(): continue
if _value.entityName() not in validNames:
_error.addErrorForKey(Validation.TYPE_MISMATCH, self.name())
***************
*** 763,770 ****
def __eq__(self, aRelationship):
"Tests whether both relationship are equal"
! if aRelationship is None or aRelationship.isFlattened():
return 0
try:
# _TBD define __eq__ for Entity
if self.name()!=aRelationship.name() or \
self.deleteRule()!=aRelationship.deleteRule() or \
--- 767,776 ----
def __eq__(self, aRelationship):
"Tests whether both relationship are equal"
! if aRelationship is None:
return 0
try:
# _TBD define __eq__ for Entity
+ if aRelationship.isFlattened():
+ return 0
if self.name()!=aRelationship.name() or \
self.deleteRule()!=aRelationship.deleteRule() or \
***************
*** 785,789 ****
for aJoin in aRelationship.joins():
if aJoin not in self._joins: return 0
! except:
return 0
return 1
--- 791,795 ----
for aJoin in aRelationship.joins():
if aJoin not in self._joins: return 0
! except: #AttributeError
return 0
return 1
***************
*** 1170,1176 ****
# values refer to the correct entity?
_values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement)
for _value in _values:
try:
! if _value.entityName()!=self.destinationEntity().name():
_error.addErrorForKey(Validation.TYPE_MISMATCH, self.name())
# remove this value from the list since following tests are inaccurate
--- 1176,1184 ----
# values refer to the correct entity?
_values2=list(_values) # _TBD do we need a copy here? (cf.'for' statement)
+ validNames=[self.destinationEntity().name()]
+ validNames+=self.destinationEntity().allSubEntitiesNames()
for _value in _values:
try:
! if _value.entityName() not in validNames:
_error.addErrorForKey(Validation.TYPE_MISMATCH, self.name())
# remove this value from the list since following tests are inaccurate
***************
*** 1201,1212 ****
self.isFlattened()!=aRelationship.isFlattened() or \
self.isMandatory()!=aRelationship.isMandatory() or \
- self.isSimple()!=aRelationship.isSimple() or \
self.destinationEntity().name()!=aRelationship.destinationEntity().name() or \
self.multiplicityLowerBound()!=aRelationship.multiplicityLowerBound() or \
self.multiplicityUpperBound()!=aRelationship.multiplicityUpperBound() or \
! self.propagatesPrimaryKey()!=aRelationship.propagatesPrimaryKey() or \
! self.ownsDestination()!=aRelationship.ownsDestination():
return 0
! except:
return 0
return 1
--- 1209,1218 ----
self.isFlattened()!=aRelationship.isFlattened() or \
self.isMandatory()!=aRelationship.isMandatory() or \
self.destinationEntity().name()!=aRelationship.destinationEntity().name() or \
self.multiplicityLowerBound()!=aRelationship.multiplicityLowerBound() or \
self.multiplicityUpperBound()!=aRelationship.multiplicityUpperBound() or \
! self.propagatesPrimaryKey()!=aRelationship.propagatesPrimaryKey():
return 0
! except AttributeError:
return 0
return 1
|