[Modeling-cvs] ProjectModeling/Modeling ClassDescription.py,1.9,1.9.6.1 Relationship.py,1.8.2.2,1.8.
Status: Abandoned
Brought to you by:
sbigaret
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), |