[Checkins] SVN: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/widgets/widgets.py Made AllFields as grok.Annotation

Darryl Cousins darryl at darrylcousins.net.nz
Fri Jul 13 16:47:14 EDT 2007


Log message for revision 77884:
  Made AllFields as grok.Annotation

Changed:
  U   Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/widgets/widgets.py

-=-
Modified: Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/widgets/widgets.py
===================================================================
--- Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/widgets/widgets.py	2007-07-13 19:56:13 UTC (rev 77883)
+++ Sandbox/darrylcousins/mars.formdemo/src/mars/formdemo/widgets/widgets.py	2007-07-13 20:47:13 UTC (rev 77884)
@@ -25,7 +25,9 @@
 
 mars.layer.layer(IDemoBrowserLayer)
 
-class AllFields(grok.Model):
+class AllFields(grok.Annotation):
+    """Register me as an annotation adapter"""
+    grok.context(zope.interface.Interface)
 
     zope.interface.implements(IAllFields)
     zope.component.adapts(zope.annotation.interfaces.IAttributeAnnotatable)
@@ -62,16 +64,6 @@
     uriField = fieldproperty.FieldProperty(IAllFields['uriField'])
     hiddenField = fieldproperty.FieldProperty(IAllFields['hiddenField'])
 
-# register the AllField class as a annotation adapter
-zope.component.provideAdapter(zope.annotation.factory(AllFields))
-
-#  fix me: this adapter factory fails because although the annotation factory
-# returns a `bound` method, when the factory is registered in the grokker it
-# appears as an `unbound` method and therefore fails when it is called
-# Is this something happening in martian????
-#class GetAllFields(mars.adapter.AdapterFactory):
-#    mars.adapter.factory(zope.annotation.factory(AllFields))
-
 class AllFieldsForm(mars.view.PageletView, form.EditForm):
     """A form showing all fields."""
     grok.name('widgets')



More information about the Checkins mailing list