Update of /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks
In directory sc8-pr-cvs1:/tmp/cvs-serv30067/Modeling/ModelMasons/Python_bricks
Modified Files:
module_base.tmpl module_compact.tmpl
Log Message:
Generated python code: __init__() now takes a keyword argument **kw,
allowing new objects to be initialized with values. Ex: b=Book(title='t')
Index: module_base.tmpl
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks/module_base.tmpl,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** module_base.tmpl 3 Aug 2003 13:58:55 -0000 1.4
--- module_base.tmpl 6 Sep 2003 11:48:05 -0000 1.5
***************
*** 21,25 ****
"""
! def __init__(self):
"Initializer"
# Note: if you modify this method, it is a strong requirement that
--- 21,25 ----
"""
! def __init__(self, **kw):
"Initializer"
# Note: if you modify this method, it is a strong requirement that
***************
*** 27,30 ****
--- 27,32 ----
# able to instanciate an object with no parameter at all.
$(base_dir).$(module_name).$(class_name).__init__(self)
+ for k,v in kw.items():
+ self.takeValueForKey(v, k)
#for attr in $entity_props:
Index: module_compact.tmpl
===================================================================
RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks/module_compact.tmpl,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** module_compact.tmpl 3 Aug 2003 13:58:10 -0000 1.2
--- module_compact.tmpl 6 Sep 2003 11:48:05 -0000 1.3
***************
*** 35,39 ****
#end unless
! def __init__(self):
"Initializer"
# Note: if you modify this method, it is a strong requirement that
--- 35,39 ----
#end unless
! def __init__(self, **kw):
"Initializer"
# Note: if you modify this method, it is a strong requirement that
***************
*** 61,65 ****
#end if
#end for
!
def entityName(self):
"Used by the framework to link this object to its entity"
--- 61,67 ----
#end if
#end for
! for k,v in kw.items():
! self.takeValueForKey(v, k)
!
def entityName(self):
"Used by the framework to link this object to its entity"
|