[Modeling-cvs] ProjectModeling/Modeling/ModelMasons/Python_bricks module.tmpl,1.4,1.5
Status: Abandoned
Brought to you by:
sbigaret
From: <sbi...@us...> - 2003-04-20 14:35:47
|
Update of /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks In directory sc8-pr-cvs1:/tmp/cvs-serv1729/ModelMasons/Python_bricks Modified Files: module.tmpl Log Message: Fixed Python_bricks/module.tmpl: do not generate e.g. setId() if 'id' is a primary key marked as a class property Index: module.tmpl =================================================================== RCS file: /cvsroot/modeling/ProjectModeling/Modeling/ModelMasons/Python_bricks/module.tmpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** module.tmpl 9 Oct 2002 13:43:26 -0000 1.4 --- module.tmpl 20 Apr 2003 14:35:44 -0000 1.5 *************** *** 44,48 **** --- 44,52 ---- #for attr in $entity_props: #if hasattr($attr, 'defaultValueAsPythonStatement'): + #if not $attr in $entity.primaryKeyAttributes(): self._$attr.name = $attr.defaultValueAsPythonStatement + #else + self._$attr.name = $attr.defaultValueAsPythonStatement # Primary Key: read-only! + #end if #end if #end for *************** *** 65,69 **** # Attribute: $attr.name ! def get$utils.capitalizeFirstLetter(attr.name())(self): "Return the $class_name / $attr.name attribute value" --- 69,76 ---- # Attribute: $attr.name ! #if $attr in $entity.primaryKeyAttributes(): ! # This attribute is a primary key: it is a READ-ONLY attribute that should ! # not be changed ! #end if def get$utils.capitalizeFirstLetter(attr.name())(self): "Return the $class_name / $attr.name attribute value" *************** *** 71,79 **** return self._$attr.name def set$utils.capitalizeFirstLetter(attr.name())(self, $attr.name): "Change the $class_name / $attr.name attribute value" self.willChange() self._$attr.name = $attr.name ! def validate$utils.capitalizeFirstLetter(attr.name())(self, value): "Edit this to enforce custom business logic" --- 78,87 ---- return self._$attr.name + #if not $attr in $entity.primaryKeyAttributes(): def set$utils.capitalizeFirstLetter(attr.name())(self, $attr.name): "Change the $class_name / $attr.name attribute value" self.willChange() self._$attr.name = $attr.name ! #end if def validate$utils.capitalizeFirstLetter(attr.name())(self, value): "Edit this to enforce custom business logic" |