[Modeling-cvs] ProjectModeling/Modeling Entity.py,1.11,1.11.2.1 Model.py,1.4,1.4.2.1 Attribute.py,1.
Status: Abandoned
Brought to you by:
sbigaret
|
From: <sbi...@us...> - 2003-05-15 17:44:23
|
Update of /cvsroot/modeling/ProjectModeling/Modeling
In directory sc8-pr-cvs1:/tmp/cvs-serv25464
Modified Files:
Tag: brch-0_9pre7-1-PyModel
Entity.py Model.py Attribute.py Relationship.py
Log Message:
Added: handleTakeStoredValueForUnboundKey(): used by PyModel e.g. when assigning 'doc' the value should go to the object's field 'comment'
Index: Entity.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Entity.py,v
retrieving revision 1.11
retrieving revision 1.11.2.1
diff -C2 -d -r1.11 -r1.11.2.1
*** Entity.py 22 Apr 2003 09:31:56 -0000 1.11
--- Entity.py 15 May 2003 17:44:19 -0000 1.11.2.1
***************
*** 33,36 ****
--- 33,37 ----
from XMLutils import *
from EntityClassDescription import EntityClassDescription
+ from KeyValueCoding import KeyValueCoding
from Model import ModelError
from Attribute import Attribute
***************
*** 115,119 ****
from Persistent import Persistent
! class Entity(XMLCapability, Persistent):
"""
Describes an entity
--- 116,120 ----
from Persistent import Persistent
! class Entity(XMLCapability, Persistent, KeyValueCoding):
"""
Describes an entity
***************
*** 1415,1420 ****
##
! ## Validation of an Entity
! ## -
##
--- 1416,1430 ----
##
! ## KeyValueCoding error handling
! ##
! def handleAssignementForUnboundKey(self, value, key):
! if key=='doc': self.setComment(value)
! else:
! raise AttributeError, key
! handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey
!
! ##
! ## TBD Validation of an Entity
! ##
##
Index: Model.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Model.py,v
retrieving revision 1.4
retrieving revision 1.4.2.1
diff -C2 -d -r1.4 -r1.4.2.1
*** Model.py 22 Apr 2003 09:31:56 -0000 1.4
--- Model.py 15 May 2003 17:44:20 -0000 1.4.2.1
***************
*** 40,44 ****
from utils import isaValidName
from XMLutils import *
!
import types
--- 40,44 ----
from utils import isaValidName
from XMLutils import *
! from KeyValueCoding import KeyValueCoding
import types
***************
*** 49,53 ****
from Persistent import Persistent
! class Model(Persistent, XMLCapability):
"Describes a model"
_is_a_model = 1
--- 49,53 ----
from Persistent import Persistent
! class Model(Persistent, XMLCapability, KeyValueCoding):
"Describes a model"
_is_a_model = 1
***************
*** 330,333 ****
--- 330,343 ----
}
+ ##
+ ## KeyValueCoding error handling
+ ##
+ def handleAssignementForUnboundKey(self, value, key):
+ if key=='connDict': self.setConnectionDictionary(value)
+ elif key=='doc': self.setComment(value)
+ else:
+ raise AttributeError, key
+ handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey
+
# Validation
#
Index: Attribute.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Attribute.py,v
retrieving revision 1.12
retrieving revision 1.12.2.1
diff -C2 -d -r1.12 -r1.12.2.1
*** Attribute.py 22 Apr 2003 09:31:56 -0000 1.12
--- Attribute.py 15 May 2003 17:44:20 -0000 1.12.2.1
***************
*** 37,40 ****
--- 37,41 ----
from XMLutils import *
from Model import ModelError
+ from KeyValueCoding import KeyValueCoding
import Validation
from Modeling.utils import capitalizeFirstLetter
***************
*** 85,89 ****
from Persistent import Persistent
! class Attribute(Persistent, XMLCapability):
"Describes an attribute"
# + public/private _TBD
--- 86,90 ----
from Persistent import Persistent
! class Attribute(Persistent, XMLCapability, KeyValueCoding):
"Describes an attribute"
# + public/private _TBD
***************
*** 678,679 ****
--- 679,688 ----
raise 'Unimplemented'
+ ##
+ ## KeyValueCoding error handling
+ ##
+ def handleAssignementForUnboundKey(self, value, key):
+ if key=='doc': self.setComment(value)
+ else:
+ raise AttributeError, key
+ handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey
Index: Relationship.py
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/Relationship.py,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** Relationship.py 22 Apr 2003 09:31:56 -0000 1.8
--- Relationship.py 15 May 2003 17:44:20 -0000 1.8.2.1
***************
*** 32,35 ****
--- 32,36 ----
from Join import Join
from utils import isaValidName, toBoolean
+ from KeyValueCoding import KeyValueCoding
from XMLutils import *
import Validation
***************
*** 64,68 ****
! class Relationship(Persistent, XMLCapability):
"See interfaces.Relationship for detail"
--- 65,69 ----
! class Relationship(Persistent, XMLCapability, KeyValueCoding):
"See interfaces.Relationship for detail"
***************
*** 205,213 ****
upperBound -- must be a strictly positive integer, or -1 for a non
! constrained to-many relationship. Special value '*' is
! equivalent to -1.
"""
! if upperBound=='*': upperBound=-1
assert(int(upperBound)>0 or int(upperBound)==-1)
self._multUpper=int(upperBound)
--- 206,214 ----
upperBound -- must be a strictly positive integer, or -1 for a non
! constrained to-many relationship. Special values '*'
! and None are equivalent to -1.
"""
! if upperBound in ('*', None): upperBound=-1
assert(int(upperBound)>0 or int(upperBound)==-1)
self._multUpper=int(upperBound)
***************
*** 339,342 ****
--- 340,344 ----
self._propagatesPK = 0
self._ownsDestination = 0
+ print 'RELATIONSHIP INIT %s'%aName
return
***************
*** 802,805 ****
--- 804,817 ----
return d
+ ##
+ ## KeyValueCoding error handling
+ ##
+ def handleAssignementForUnboundKey(self, value, key):
+ if key=='doc': self.setComment(value)
+ elif key=='delete': self.setDeleteRule(value)
+ else:
+ raise AttributeError, key
+ handleTakeStoredValueForUnboundKey=handleAssignementForUnboundKey
+
class FlattenedRelationship(Relationship):
***************
*** 1162,1166 ****
return d
-
# Validation
#
--- 1174,1177 ----
|