[Checkins] SVN: grok/branches/luciano-fields-class-removal/src/grok/ftests/form/ adopted FieldProperty idiom to set model attributes from declared interfaces

Luciano Ramalho luciano at ramalho.org
Thu Sep 13 13:58:58 EDT 2007


Log message for revision 79618:
  adopted FieldProperty idiom to set model attributes from declared interfaces
  

Changed:
  U   grok/branches/luciano-fields-class-removal/src/grok/ftests/form/actions.py
  U   grok/branches/luciano-fields-class-removal/src/grok/ftests/form/form.py

-=-
Modified: grok/branches/luciano-fields-class-removal/src/grok/ftests/form/actions.py
===================================================================
--- grok/branches/luciano-fields-class-removal/src/grok/ftests/form/actions.py	2007-09-13 15:29:05 UTC (rev 79617)
+++ grok/branches/luciano-fields-class-removal/src/grok/ftests/form/actions.py	2007-09-13 17:58:57 UTC (rev 79618)
@@ -46,6 +46,7 @@
 import grok
 from zope import schema
 from zope.interface import Interface, implements
+from zope.schema.fieldproperty import FieldProperty
 
 class IMammoth(Interface):
     name = schema.TextLine(title=u"Name")
@@ -54,8 +55,8 @@
 class Mammoth(grok.Model):
     implements(IMammoth)
     
-    name = None
-    size = None
+    name = FieldProperty(IMammoth['name'])    
+    size = FieldProperty(IMammoth['size'])    
 
 class Edit(grok.EditForm):
     @grok.action("Apply")

Modified: grok/branches/luciano-fields-class-removal/src/grok/ftests/form/form.py
===================================================================
--- grok/branches/luciano-fields-class-removal/src/grok/ftests/form/form.py	2007-09-13 15:29:05 UTC (rev 79617)
+++ grok/branches/luciano-fields-class-removal/src/grok/ftests/form/form.py	2007-09-13 17:58:57 UTC (rev 79618)
@@ -29,6 +29,7 @@
 import grok
 from zope import schema
 from zope.interface import Interface, implements
+from zope.schema.fieldproperty import FieldProperty
 
 class IMammoth(Interface):
     name = schema.TextLine(title=u"Name")
@@ -37,8 +38,8 @@
 class Mammoth(grok.Model):
     implements(IMammoth)
     
-    name = None
-    size = None
+    name = FieldProperty(IMammoth['name'])    
+    size = FieldProperty(IMammoth['size'])    
 
 class Edit(grok.EditForm):
     pass



More information about the Checkins mailing list