[Zope3-checkins] SVN: zope.formlib/trunk/ Bugs Fix: The zope.formlib.form.Action class didn't fully implement

Jim Fulton jim at zope.com
Thu Apr 17 10:26:08 EDT 2008


Log message for revision 85458:
  Bugs Fix: The zope.formlib.form.Action class didn't fully implement
  zope.formlib.interfaces.IAction.
  

Changed:
  U   zope.formlib/trunk/CHANGES.txt
  U   zope.formlib/trunk/src/zope/formlib/form.py
  U   zope.formlib/trunk/src/zope/formlib/interfaces.py
  U   zope.formlib/trunk/src/zope/formlib/tests.py

-=-
Modified: zope.formlib/trunk/CHANGES.txt
===================================================================
--- zope.formlib/trunk/CHANGES.txt	2008-04-17 12:14:39 UTC (rev 85457)
+++ zope.formlib/trunk/CHANGES.txt	2008-04-17 14:26:08 UTC (rev 85458)
@@ -5,6 +5,9 @@
 3.5.0 (unreleased)
 ==================
 
+New Features
+------------
+
 * Introduced ``zope.formlib.form.applyData`` which works like
   ``applyChanges`` but returns a dictionary with information about
   which attribute of which schema changed.  This information is then
@@ -12,8 +15,13 @@
 
   This fixes https://bugs.launchpad.net/zope3/+bug/98483.
 
-* ...
+Bugs Fixed
+----------
 
+- The zope.formlib.form.Action class didn't fully implement
+  zope.formlib.interfaces.IAction.
+
+
 3.4.0 (2007-09-28)
 ==================
 

Modified: zope.formlib/trunk/src/zope/formlib/form.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/form.py	2008-04-17 12:14:39 UTC (rev 85457)
+++ zope.formlib/trunk/src/zope/formlib/form.py	2008-04-17 14:26:08 UTC (rev 85458)
@@ -572,12 +572,17 @@
             else:
                 name = label.encode('hex')
 
-        self.__name__ = expandPrefix(prefix) + name
+        self.name = name
+        self.setPrefix(prefix)
 
         if data is None:
             data = {}
         self.data = data
 
+    def setPrefix(self, prefix):
+        self.prefix = prefix
+        self.__name__ = expandPrefix(prefix) + self.name
+
     def __get__(self, form, class_=None):
         if form is None:
             return self

Modified: zope.formlib/trunk/src/zope/formlib/interfaces.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/interfaces.py	2008-04-17 12:14:39 UTC (rev 85457)
+++ zope.formlib/trunk/src/zope/formlib/interfaces.py	2008-04-17 14:26:08 UTC (rev 85458)
@@ -704,6 +704,7 @@
     label = schema.TextLine(title=u"Action label")
 
     name = schema.TextLine(title=u"Action name")
+    __name__ = schema.TextLine(title=u"Action name with its prefix")
 
     data = schema.Dict(title=u"Application data")
 

Modified: zope.formlib/trunk/src/zope/formlib/tests.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests.py	2008-04-17 12:14:39 UTC (rev 85457)
+++ zope.formlib/trunk/src/zope/formlib/tests.py	2008-04-17 14:26:08 UTC (rev 85458)
@@ -480,6 +480,16 @@
 
     """
 
+def test_Action_interface():
+    """
+    >>> action = form.Action('foo')
+    >>> import zope.interface.verify
+    >>> import zope.formlib.interfaces
+    >>> zope.interface.verify.verifyObject(zope.formlib.interfaces.IAction,
+    ...                                    action)
+    True
+    """
+
 def test_suite():
     from zope.testing import doctest
     checker = renormalizing.RENormalizing([



More information about the Zope3-Checkins mailing list