[Zope3-checkins] SVN: zope.formlib/trunk/ Drop support for Python 2.5.

Tres Seaver cvs-admin at zope.org
Fri May 18 14:37:19 UTC 2012


Log message for revision 126109:
  Drop support for Python 2.5.
  
  Replace deprecated 'zope.component.adapts' usage with equivalent
  'zope.component.adapter' decorator.
  
  Replace deprecated 'zope.interface.implements' usage with equivalent
  'zope.interface.implementer' decorator.
  
  

Changed:
  U   zope.formlib/trunk/CHANGES.txt
  U   zope.formlib/trunk/setup.py
  U   zope.formlib/trunk/src/zope/formlib/errors.py
  U   zope.formlib/trunk/src/zope/formlib/errors.txt
  U   zope.formlib/trunk/src/zope/formlib/exception.py
  U   zope.formlib/trunk/src/zope/formlib/form.py
  U   zope.formlib/trunk/src/zope/formlib/form.txt
  U   zope.formlib/trunk/src/zope/formlib/interfaces.py
  U   zope.formlib/trunk/src/zope/formlib/itemswidgets.py
  U   zope.formlib/trunk/src/zope/formlib/objectwidget.py
  U   zope.formlib/trunk/src/zope/formlib/objectwidget.txt
  U   zope.formlib/trunk/src/zope/formlib/sequencewidget.py
  U   zope.formlib/trunk/src/zope/formlib/source.py
  U   zope.formlib/trunk/src/zope/formlib/source.txt
  U   zope.formlib/trunk/src/zope/formlib/tests/test_browserwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_formlib.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_booleanradiowidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_checkboxwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_datetimewidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_decimalwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_filewidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_floatwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_intwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_objectwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_selectwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_textareawidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_functional_textwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_itemswidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_multicheckboxwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_objectwidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_radiowidget.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_registrations.py
  U   zope.formlib/trunk/src/zope/formlib/tests/test_sequencewidget.py
  U   zope.formlib/trunk/src/zope/formlib/textwidgets.py
  U   zope.formlib/trunk/src/zope/formlib/widget.py

-=-
Modified: zope.formlib/trunk/CHANGES.txt
===================================================================
--- zope.formlib/trunk/CHANGES.txt	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/CHANGES.txt	2012-05-18 14:37:15 UTC (rev 126109)
@@ -2,12 +2,18 @@
 Changes
 =======
 
-4.1.2 (unreleased)
+4.2.0 (unreleased)
 ==================
 
-- Nothing changed yet.
+- Replaced deprecated ``zope.component.adapts`` usage with equivalent
+  ``zope.component.adapter`` decorator.
 
+- Replaced deprecated ``zope.interface.implements`` usage with equivalent
+  ``zope.interface.implementer`` decorator.
 
+- Dropped support for Python 2.5.
+
+
 4.1.1 (2012-03-16)
 ==================
 

Modified: zope.formlib/trunk/setup.py
===================================================================
--- zope.formlib/trunk/setup.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/setup.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -24,7 +24,7 @@
 def read(*rnames):
     return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
 
-version = '4.1.2dev'
+version = '4.2.0dev'
 
 setup(name='zope.formlib',
       version=version,
@@ -42,9 +42,7 @@
         'License :: OSI Approved',
         'Natural Language :: English',
         'Operating System :: OS Independent',
-        'Programming Language :: Python :: 2 :: Only',
         'Programming Language :: Python :: 2',
-        'Programming Language :: Python :: 2.5',
         'Programming Language :: Python :: 2.6',
         'Programming Language :: Python :: 2.7',
         'Programming Language :: Python',

Modified: zope.formlib/trunk/src/zope/formlib/errors.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/errors.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/errors.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,8 +16,8 @@
 
 from cgi import escape
 
-from zope.component import adapts
-from zope.interface import implements
+from zope.component import adapter
+from zope.interface import implementer
 from zope.interface import Invalid
 from zope.i18n import Message
 from zope.i18n import translate
@@ -26,13 +26,11 @@
 from zope.publisher.interfaces.browser import IBrowserRequest
 
 
+ at implementer(IWidgetInputErrorView)
+ at adapter(Invalid, IBrowserRequest)
 class InvalidErrorView(object):
-
     """Display a validation error as a snippet of text."""
 
-    implements(IWidgetInputErrorView)
-    adapts(Invalid, IBrowserRequest)
-
     def __init__(self, context, request):
         self.context = context
         self.request = request

Modified: zope.formlib/trunk/src/zope/formlib/errors.txt
===================================================================
--- zope.formlib/trunk/src/zope/formlib/errors.txt	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/errors.txt	2012-05-18 14:37:15 UTC (rev 126109)
@@ -36,8 +36,8 @@
 
     >>> from zope import component, interface
     >>> from zope.i18n.interfaces import INegotiator
-    >>> class Negotiator:
-    ...     interface.implements(INegotiator)
+    >>> @interface.implementer(INegotiator)
+    ... class Negotiator:
     ...     def getLanguage(*ignored): return 'test'
     >>> component.provideUtility(Negotiator())
     >>> from zope.i18n.testmessagecatalog import TestMessageFallbackDomain

Modified: zope.formlib/trunk/src/zope/formlib/exception.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/exception.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/exception.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -17,14 +17,14 @@
 
 from cgi import escape
 
-from zope.interface import implements
+from zope.interface import implementer
 from zope.i18n import translate
 
 from zope.formlib.interfaces import IWidgetInputError, IWidgetInputErrorView
 
+ at implementer(IWidgetInputErrorView)
 class WidgetInputErrorView(object):
     """Display an input error as a snippet of text."""
-    implements(IWidgetInputErrorView)
 
     __used_for__ = IWidgetInputError
 

Modified: zope.formlib/trunk/src/zope/formlib/form.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/form.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/form.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -58,10 +58,9 @@
         return prefix + '.'
     return prefix
 
+ at interface.implementer(interfaces.IFormField)
 class FormField:
 
-    interface.implements(interfaces.IFormField)
-
     def __init__(self, field, name=None, prefix='',
                  for_display=None, for_input=None, custom_widget=None,
                  render_context=False, get_rendered=None, interface=None
@@ -88,10 +87,9 @@
     return keep_readonly, omit_readonly, defaults
 
 
+ at interface.implementer(interfaces.IFormFields)
 class FormFields(object):
 
-    interface.implements(interfaces.IFormFields)
-
     def __init__(self, *args, **kw):
         keep_readonly, omit_readonly, defaults = _initkw(**kw)
 
@@ -178,10 +176,9 @@
     return FormFields(*args, **other)
 
 
+ at interface.implementer(interfaces.IWidgets)
 class Widgets(object):
 
-    interface.implements(interfaces.IWidgets)
-
     def __init__(self, widgets, prefix_length=None, prefix=None):
         self.__Widgets_widgets_items__ = widgets
         self.__Widgets_widgets_list__ = [w for (i, w) in widgets]
@@ -568,9 +565,8 @@
         return lambda form, *args: getattr(form, meth)(*args)
 
 
+ at interface.implementer(interfaces.IAction)
 class Action(object):
-
-    interface.implements(interfaces.IAction)
     _identifier = re.compile('[A-Za-z][a-zA-Z0-9_]*$')
 
     def __init__(self, label, success=None, failure=None,
@@ -676,10 +672,9 @@
         return action
 
 
+ at interface.implementer(interfaces.IActions)
 class Actions(object):
 
-    interface.implements(interfaces.IActions)
-
     def __init__(self, *actions):
         self.actions = actions
         self.byname = dict([(a.__name__, a) for a in actions])
@@ -733,6 +728,7 @@
     return result
 
 
+ at interface.implementer(interfaces.IForm)
 class FormBase(zope.publisher.browser.BrowserPage):
 
     label = u''
@@ -745,7 +741,6 @@
 
     ignoreContext = False
 
-    interface.implements(interfaces.IForm)
 
     def setPrefix(self, prefix):
         self.prefix = prefix
@@ -895,16 +890,15 @@
     actions = ()
 
 
+ at interface.implementer(interfaces.IAddFormCustomization,
+                       zope.component.interfaces.IFactory)
+ at component.adapter(zope.browser.interfaces.IAdding,
+                   zope.publisher.interfaces.browser.IBrowserRequest)
 class AddFormBase(FormBase):
 
     ignoreContext = True
 
-    interface.implements(interfaces.IAddFormCustomization,
-                         zope.component.interfaces.IFactory)
 
-    component.adapts(zope.browser.interfaces.IAdding,
-                     zope.publisher.interfaces.browser.IBrowserRequest)
-
     def __init__(self, context, request):
         self.__parent__ = context
         super(AddFormBase, self).__init__(context, request)
@@ -953,38 +947,38 @@
 default_subpage_template = namedtemplate.NamedTemplateImplementation(
     ViewPageTemplateFile('subpageform.pt'), interfaces.ISubPageForm)
 
+ at interface.implementer(interfaces.IPageForm)
 class PageForm(FormBase):
+    pass
 
-    interface.implements(interfaces.IPageForm)
-
 Form = PageForm
 
+ at interface.implementer(interfaces.IPageForm)
 class PageEditForm(EditFormBase):
+    pass
 
-    interface.implements(interfaces.IPageForm)
-
 EditForm = PageEditForm
 
+ at interface.implementer(interfaces.IPageForm)
 class PageDisplayForm(DisplayFormBase):
+    pass
 
-    interface.implements(interfaces.IPageForm)
-
 DisplayForm = PageDisplayForm
 
+ at interface.implementer(interfaces.IPageForm)
 class PageAddForm(AddFormBase):
+    pass
 
-    interface.implements(interfaces.IPageForm)
-
 AddForm = PageAddForm
 
+ at interface.implementer(interfaces.ISubPageForm)
 class SubPageForm(FormBase):
+    pass
 
-    interface.implements(interfaces.ISubPageForm)
-
+ at interface.implementer(interfaces.ISubPageForm)
 class SubPageEditForm(EditFormBase):
+    pass
 
-    interface.implements(interfaces.ISubPageForm)
-
+ at interface.implementer(interfaces.ISubPageForm)
 class SubPageDisplayForm(DisplayFormBase):
-
-    interface.implements(interfaces.ISubPageForm)
+    pass

Modified: zope.formlib/trunk/src/zope/formlib/form.txt
===================================================================
--- zope.formlib/trunk/src/zope/formlib/form.txt	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/form.txt	2012-05-18 14:37:15 UTC (rev 126109)
@@ -403,8 +403,8 @@
 that uses it:
 
     >>> import datetime
-    >>> class Order:
-    ...     interface.implements(IOrder)
+    >>> @interface.implementer(IOrder)
+    ... class Order:
     ...
     ...     def __init__(self, identifier):
     ...         self.identifier = identifier
@@ -1099,9 +1099,9 @@
 on objects:
 
     >>> from zope import component
-    >>> class Descriptive(object):
-    ...     component.adapts(interface.Interface)
-    ...     interface.implements(IDescriptive)
+    >>> @component.adapter(interface.Interface)
+    ... @interface.implementer(IDescriptive)
+    ... class Descriptive(object):
     ...     def __init__(self, context):
     ...         self.context = context
     ...
@@ -1772,8 +1772,8 @@
 
 Note: If this behavior ever changes, the formlib can be simplified again.
 
-  >>> class FooBar(object):
-  ...     zope.interface.implements(IFooBar)
+  >>> @zope.interface.implementer(IFooBar)
+  ... class FooBar(object):
   ...     title = u'initial'
   >>> foobar = FooBar()
 

Modified: zope.formlib/trunk/src/zope/formlib/interfaces.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/interfaces.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/interfaces.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -17,7 +17,7 @@
 from zope.publisher.interfaces.browser import IBrowserPage
 from zope.schema.interfaces import ValidationError
 from zope.publisher.interfaces import IView
-from zope.interface import Attribute, Interface, implements, Invalid
+from zope.interface import Attribute, Interface, implementer, Invalid
 from zope.schema import Bool
 from zope.exceptions.interfaces import UserError
 
@@ -27,11 +27,10 @@
     def doc():
         """Returns a string that represents the error message."""
 
+ at implementer(IWidgetInputError)
 class WidgetInputError(UserError):
     """One or more user input errors occurred."""
 
-    implements(IWidgetInputError)
-
     def __init__(self, field_name, widget_title, errors=None):
         """Initialize Error
 
@@ -56,11 +55,10 @@
     """Required data was not supplied."""
 
 
+ at implementer(IWidgetInputError)
 class ConversionError(Exception):
     """A conversion error occurred."""
 
-    implements(IWidgetInputError)
-
     def __init__(self, error_name, original_exception=None):
         Exception.__init__(self, error_name, original_exception)
         self.error_name = error_name

Modified: zope.formlib/trunk/src/zope/formlib/itemswidgets.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/itemswidgets.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/itemswidgets.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -17,7 +17,7 @@
 from xml.sax.saxutils import escape
 
 from zope import component
-from zope.interface import implements
+from zope.interface import implementer
 from zope.i18n import translate
 from zope.schema.interfaces import InvalidValue
 from zope.schema.interfaces import ITitledTokenizedTerm
@@ -299,13 +299,13 @@
 EXPLICIT_EMPTY_SELECTION = True
 
 
+ at implementer(IInputWidget)
 class ItemsEditWidgetBase(SingleDataHelper, ItemsWidgetBase):
     """Widget Base for rendering item-related fields.
 
     These widgets work with Choice fields and Sequence fields that have Choice
     as value_type.
     """
-    implements(IInputWidget)
 
     size = 5
     tag = 'select'

Modified: zope.formlib/trunk/src/zope/formlib/objectwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/objectwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/objectwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,7 @@
 __docformat__ = 'restructuredtext'
 
 from zope import component
-from zope.interface import implements
+from zope.interface import implementer
 from zope.schema import getFieldNamesInOrder
 
 from zope.formlib.interfaces import IInputWidget
@@ -39,6 +39,7 @@
         return self.template()
 
 
+ at implementer(IInputWidget)
 class ObjectWidget(BrowserWidget, InputWidget):
     """A widget over an Interface that contains Fields.
 
@@ -52,8 +53,6 @@
       widget
     """
 
-    implements(IInputWidget)
-
     _object = None      # the object value (from setRenderedValue & request)
     _request_parsed = False
 

Modified: zope.formlib/trunk/src/zope/formlib/objectwidget.txt
===================================================================
--- zope.formlib/trunk/src/zope/formlib/objectwidget.txt	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/objectwidget.txt	2012-05-18 14:37:15 UTC (rev 126109)
@@ -5,7 +5,7 @@
 The following example shows a Family with Mother and Father.
 First define the interface for a person:
 
-  >>> from zope.interface import Interface, implements
+  >>> from zope.interface import Interface, implementer
   >>> from zope.schema import TextLine
 
   >>> class IPerson(Interface):
@@ -15,10 +15,8 @@
 
 Let's define the class:
 
-  >>> class Person(object):
-  ...
-  ...     implements(IPerson)
-  ...
+  >>> @implementer(IPerson)
+  ... class Person(object):
   ...     def __init__(self, name=''):
   ...         self.name = name
 
@@ -42,11 +40,9 @@
 
   >>> from zope.schema.fieldproperty import FieldProperty
 
-  >>> class Family(object):
+  >>> @implementer(IFamily)
+  ... class Family(object):
   ...     """The familiy interface."""
-  ...
-  ...     implements(IFamily)
-  ...
   ...     mother = FieldProperty(IFamily['mother'])
   ...     father = FieldProperty(IFamily['father'])
   ...

Modified: zope.formlib/trunk/src/zope/formlib/sequencewidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/sequencewidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/sequencewidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,7 @@
 __docformat__ = 'restructuredtext'
 
 from zope import component
-from zope.interface import implements
+from zope.interface import implementer
 from zope.i18n import translate
 from zope.schema.interfaces import ValidationError
 
@@ -29,6 +29,7 @@
 from zope.browserpage import ViewPageTemplateFile
 
 
+ at implementer(IInputWidget)
 class SequenceWidget(BrowserWidget, InputWidget):
     """A widget baseclass for a sequence of fields.
 
@@ -36,8 +37,6 @@
                  items in the sequence
     """
 
-    implements(IInputWidget)
-
     template = ViewPageTemplateFile('sequencewidget.pt')
 
     _type = tuple

Modified: zope.formlib/trunk/src/zope/formlib/source.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/source.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/source.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -18,8 +18,8 @@
 
 import xml.sax.saxutils
 
-from zope.component import adapts, getMultiAdapter
-from zope.interface import implements
+from zope.component import adapter, getMultiAdapter
+from zope.interface import implementer
 import zope.browser.interfaces
 import zope.schema.interfaces
 from zope.schema.interfaces import \
@@ -43,10 +43,9 @@
 import zope.formlib.itemswidgets
 from zope.formlib.widget import DisplayWidget
 
+ at implementer(IDisplayWidget)
 class SourceDisplayWidget(DisplayWidget):
 
-    implements(IDisplayWidget)
-
     def __init__(self, field, source, request):
         super(SourceDisplayWidget, self).__init__(field, request)
         self.source = source
@@ -117,11 +116,11 @@
         return '<br />\n'.join(result)
 
 
+ at implementer(IInputWidget)
 class SourceInputWidget(InputWidget):
 
     _error = None
 
-    implements(IInputWidget)
 
     def __init__(self, field, source, request):
         super(SourceInputWidget, self).__init__(field, request)
@@ -511,6 +510,8 @@
 # should be updated into full implementations.
 
 
+ at implementer(IVocabularyTokenized)
+ at adapter(IIterableSource)
 class IterableSourceVocabulary(object):
 
     """Adapts an iterable source into a legacy vocabulary.
@@ -520,9 +521,6 @@
     registered to obtain the terms.
     """
 
-    implements(IVocabularyTokenized)
-    adapts(IIterableSource);
-
     def __init__(self, source, request):
         self.source = source
         self.terms = getMultiAdapter((source, request),

Modified: zope.formlib/trunk/src/zope/formlib/source.txt
===================================================================
--- zope.formlib/trunk/src/zope/formlib/source.txt	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/source.txt	2012-05-18 14:37:15 UTC (rev 126109)
@@ -29,10 +29,9 @@
   >>> from zope.browser.interfaces import ITerms
   >>> import zope.publisher.interfaces.browser
   >>> from zope.schema.vocabulary import SimpleTerm
-  >>> class ListTerms:
+  >>> @zope.interface.implementer(ITerms)
+  ... class ListTerms:
   ...
-  ...     zope.interface.implements(ITerms)
-  ...
   ...     def __init__(self, source, request):
   ...         pass # We don't actually need the source or the request :)
   ...
@@ -72,8 +71,9 @@
 Let's start with a simple example.  We have a very trivial source,
 which is basically a list::
 
-  >>> class SourceList(list):
-  ...     zope.interface.implements(zope.schema.interfaces.IIterableSource)
+  >>> @zope.interface.implementer(zope.schema.interfaces.IIterableSource)
+  ... class SourceList(list):
+  ...     pass
 
 We need to register our `ITerms` view::
 
@@ -514,8 +514,9 @@
 Let's start with a simple example.  We have a very trivial source,
 which is basically a list:
 
-  >>> class SourceList(list):
-  ...     zope.interface.implements(zope.schema.interfaces.ISource)
+  >>> @zope.interface.implementer(zope.schema.interfaces.ISource)
+  ... class SourceList(list):
+  ...     pass
 
 We need to register our `ITerms` view::
 
@@ -527,14 +528,13 @@
 itself will be used as it's own queriable.  We need to provide a query view
 for the source::
 
-  >>> class ListQueryView:
-  ...
-  ...     zope.interface.implements(
+  >>> @zope.interface.implementer(
   ...         zope.formlib.interfaces.ISourceQueryView)
-  ...     zope.component.adapts(
+  ... @zope.component.adapter(
   ...         SourceList,
   ...         zope.publisher.interfaces.browser.IBrowserRequest,
   ...         )
+  ... class ListQueryView:
   ...
   ...     def __init__(self, source, request):
   ...         self.source = source
@@ -703,12 +703,11 @@
 Now, let's look at a more complicated example. We'll define a source that
 combines multiple sources::
 
-  >>> class MultiSource:
-  ...
-  ...     zope.interface.implements(
+  >>> @zope.interface.implementer(
   ...        zope.schema.interfaces.ISource,
   ...        zope.schema.interfaces.ISourceQueriables,
   ...        )
+  ... class MultiSource:
   ...
   ...     def __init__(self, *sources):
   ...         self.sources = [(unicode(i), s) for (i, s) in enumerate(sources)]
@@ -1069,12 +1068,13 @@
   >>> terms = [SimpleTerm(values[i], token=tokens[i], title=titles[i]) \
   ...     for i in range(0,len(values))]
 
-  >>> class TestSource(list):
-  ...     zope.interface.implements(zope.schema.interfaces.IIterableSource)
+  >>> @zope.interface.implementer(zope.schema.interfaces.IIterableSource)
+  ... class TestSource(list):
+  ...     pass
   >>> source = TestSource(values)
 
-  >>> class TestTerms(object):
-  ...     zope.interface.implements(ITerms)
+  >>> @zope.interface.implementer(ITerms)
+  ... class TestTerms(object):
   ...     def __init__(self, source, request):
   ...         pass
   ...     def getTerm(self, value):

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_browserwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_browserwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_browserwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 from zope.component.testing import PlacelessSetup
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.publisher.browser import TestRequest
 from zope.schema import Text, Int
 from doctest import DocTestSuite
@@ -38,8 +38,9 @@
             __name__='foo', title=title, description=desc)
         class ITestContent(Interface):
             foo = field
+        @implementer(ITestContent)
         class TestObject:
-            implements(ITestContent)
+            pass
         self.content = TestObject()
         field = ITestContent['foo']
         field = field.bind(self.content)

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_formlib.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_formlib.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_formlib.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,6 @@
 
 from zope.component.testing import setUp, tearDown
 from zope.component import adapter
-from zope.component import adapts
 from zope.component import provideAdapter, provideUtility
 
 from zope.i18n.testing import setUp as i18nSetUp
@@ -176,17 +175,17 @@
     description = zope.schema.TextLine(title=u"Description")
 
 
+ at zope.interface.implementer(IOrder)
 class Order:
-    zope.interface.implements(IOrder)
     identifier = 1
     name = 'unknown'
     min_size = 1.0
     max_size = 10.0
 
 
+ at adapter(IOrder)
+ at zope.interface.implementer(IDescriptive)
 class Descriptive(object):
-    adapts(IOrder)
-    zope.interface.implements(IDescriptive)
     def __init__(self, context):
         self.context = context
 
@@ -259,8 +258,8 @@
 translation domain.  We'll create one for our needs:
 
     >>> import zope.i18n.interfaces
-    >>> class MyDomain:
-    ...     zope.interface.implements(zope.i18n.interfaces.ITranslationDomain)
+    >>> @zope.interface.implementer(zope.i18n.interfaces.ITranslationDomain)
+    ... class MyDomain:
     ...
     ...     def translate(self, msgid, mapping=None, context=None,
     ...                   target_language=None, default=None):
@@ -295,8 +294,8 @@
 erros raised by the widgets getInputValue method.
 
     >>> import zope.formlib.interfaces
-    >>> class Widget(object):
-    ...     zope.interface.implements(zope.formlib.interfaces.IInputWidget)
+    >>> @zope.interface.implementer(zope.formlib.interfaces.IInputWidget)
+    ... class Widget(object):
     ...     def __init__(self):
     ...         self.name = 'form.summary'
     ...         self.label = 'Summary'
@@ -319,8 +318,8 @@
 yesterday the sequence input widget, I decided to catch ValidationError also
 in the formlib as a fallback if some widget doen't handle errors correct. (ri)
 
-    >>> class Widget(object):
-    ...     zope.interface.implements(zope.formlib.interfaces.IInputWidget)
+    >>> @zope.interface.implementer(zope.formlib.interfaces.IInputWidget)
+    ... class Widget(object):
     ...     def __init__(self):
     ...         self.name = 'form.summary'
     ...         self.label = 'summary'
@@ -383,9 +382,9 @@
 that lets us look up the macros.
 
     >>> import zope.traversing.interfaces
-    >>> class view:
-    ...     adapts(None, None)
-    ...     zope.interface.implements(zope.traversing.interfaces.ITraversable)
+    >>> @adapter(None, None)
+    ... @zope.interface.implementer(zope.traversing.interfaces.ITraversable)
+    ... class view:
     ...     def __init__(self, ob, r=None):
     ...         pass
     ...     def traverse(*args):
@@ -403,8 +402,8 @@
 negotiator that always decides to use the test language:
 
     >>> import zope.i18n.interfaces
-    >>> class Negotiator:
-    ...     zope.interface.implements(zope.i18n.interfaces.INegotiator)
+    >>> @zope.interface.implementer(zope.i18n.interfaces.INegotiator)
+    ... class Negotiator:
     ...     def getLanguage(*ignored):
     ...         return 'test'
 
@@ -483,8 +482,8 @@
 
     Let's call setUpDataWidgets and see their names:
 
-        >>> class Trivial(object):
-        ...     interface.implements(ITrivial)
+        >>> @interface.implementer(ITrivial)
+        ... class Trivial(object):
         ...     name = 'foo'
         >>> context = Trivial()
 
@@ -646,8 +645,8 @@
     ...         if data.value > data.max:
     ...             raise zope.interface.Invalid('value bigger than max')
 
-    >>> class Content(object):
-    ...     zope.interface.implements(IFlexMaximum)
+    >>> @zope.interface.implementer(IFlexMaximum)
+    ... class Content(object):
     ...     max = 10
     ...     value = 7
 
@@ -704,8 +703,8 @@
     >>> class IStaticMaximum(zope.interface.Interface):
     ...     max = zope.interface.Attribute("Predefined maximum")
 
-    >>> class Content(object):
-    ...     zope.interface.implements(IStaticMaximum)
+    >>> @zope.interface.implementer(IStaticMaximum)
+    ... class Content(object):
     ...     max = 10
 
     >>> formdata = zope.formlib.form.FormData(IStaticMaximum, {}, Content())
@@ -722,8 +721,9 @@
     >>> class IStaticMaximum(zope.interface.Interface):
     ...     def max(): pass
 
-    >>> class Content(object):
-    ...     zope.interface.implements(IStaticMaximum)
+    >>> @zope.interface.implementer(IStaticMaximum)
+    ... class Content(object):
+    ...     pass
 
     >>> formdata = zope.formlib.form.FormData(IStaticMaximum, {}, Content())
     >>> formdata.max

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_booleanradiowidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_booleanradiowidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_booleanradiowidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Bool
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -27,8 +27,8 @@
 class IFoo(Interface):
     bar = Bool(title=u'Bar')
 
+ at implementer(IFoo)
 class Foo(object):
-    implements(IFoo)
     def __init__(self):
         self.bar = True
 

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_checkboxwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_checkboxwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_checkboxwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Bool
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -32,10 +32,9 @@
     b2 = Bool(
         required=False)
 
+ at implementer(IBoolTest)
 class BoolTest(object):
 
-    implements(IBoolTest)
-
     def __init__(self):
         self.b1 = True
         self.b2 = False

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_datetimewidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_datetimewidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_datetimewidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -18,7 +18,7 @@
 import re
 from datetime import datetime
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Datetime, Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -43,10 +43,9 @@
             datetime(2003, 10, 15, tzinfo=tzinfo(0))),
         missing_value=datetime(2000, 1, 1, tzinfo=tzinfo(0)))
 
+ at implementer(IDatetimeTest)
 class DatetimeTest(object):
 
-    implements(IDatetimeTest)
-
     def __init__(self):
         self.d1 = datetime(2003, 4, 6, tzinfo=tzinfo(0))
         self.d2 = datetime(2003, 8, 6, tzinfo=tzinfo(0))

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_decimalwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_decimalwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_decimalwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,7 @@
 import unittest
 
 import decimal
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Decimal, Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -46,10 +46,9 @@
         missing_value=0)
 
 
+ at implementer(IDecimalTest)
 class DecimalTest(object):
 
-    implements(IDecimalTest)
-
     def __init__(self):
         self.f1 = None
         self.f2 = decimal.Decimal("1.1")

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_filewidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_filewidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_filewidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,7 @@
 import unittest
 
 from StringIO import StringIO
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Field
 from zope.schema.interfaces import IField
 from zope.formlib import form
@@ -28,15 +28,16 @@
 class IFileField(IField):
     """Field for representing a file that can be edited by FileWidget."""
 
+ at implementer(IFileField)
 class FileField(Field):
-    implements(IFileField)
+    pass
 
 class IFileTest(Interface):
     f1 = FileField(required=True)
     f2 = FileField(required=False)
 
+ at implementer(IFileTest)
 class FileTest(object):
-    implements(IFileTest)
 
     def __init__(self):
         self.f1 = None

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_floatwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_floatwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_floatwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Float, Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -41,10 +41,9 @@
         values=(0.0, 1.1, 2.1, 3.1, 5.1, 7.1, 11.1),
         missing_value=0)
 
+ at implementer(IFloatTest)
 class FloatTest(object):
 
-    implements(IFloatTest)
-
     def __init__(self):
         self.f1 = None
         self.f2 = 1.1

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_intwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_intwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_intwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Int, Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -51,20 +51,18 @@
         values=(10, 20, 30))
 
 
+ at implementer(IIntTest)
 class IntTest(object):
 
-    implements(IIntTest)
-
     def __init__(self):
         self.i1 = None
         self.i2 = 1
         self.i3 = 2
 
 
+ at implementer(IIntTest2)
 class IntTest2(object):
 
-    implements(IIntTest2)
-
     def __init__(self):
         self.i1 = 10
 

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_objectwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_objectwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_objectwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -20,7 +20,7 @@
 from zope.component import provideAdapter
 from zope.traversing.adapters import DefaultTraversable
 from zope.component.testing import PlacelessSetup
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import TextLine, Object
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -36,8 +36,9 @@
     name = TextLine()
     email = TextLine()
 
+ at implementer(ITestContact)
 class TestContact(object):
-    implements(ITestContact)
+    pass
 
 class Form(form.EditForm):
     form_fields = form.fields(ITestContact)
@@ -63,9 +64,9 @@
         data = f.read()
         f.close()
         macro_template.write(data)
+        @zope.component.adapter(None, None)
+        @implementer(zope.traversing.interfaces.ITraversable)
         class view:
-            zope.component.adapts(None, None)
-            zope.interface.implements(zope.traversing.interfaces.ITraversable)
             def __init__(self, ob, r=None):
                 pass
             def traverse(*args):

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_selectwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_selectwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_selectwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -36,10 +36,9 @@
         required=True,
         values=(u'1', u'2', u'3'))
 
+ at implementer(IRadioTest)
 class RadioTest(object):
 
-    implements(IRadioTest)
-
     def __init__(self):
         self.s3 = None
         self.s4 = u'1'

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_textareawidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_textareawidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_textareawidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Text
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -37,10 +37,9 @@
     s3 = Text(
         required=False)
 
+ at implementer(ITextTest)
 class TextTest(object):
 
-    implements(ITextTest)
-
     def __init__(self):
         self.s1 = ''
         self.s2 = u'foo'

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_functional_textwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_functional_textwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_functional_textwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import TextLine, Choice
 from zope.formlib import form
 from zope.publisher.browser import TestRequest
@@ -40,10 +40,9 @@
         required=False,
         values=(u'Bob', u'is', u'Your', u'Uncle'))
 
+ at implementer(ITextLineTest)
 class TextLineTest(object):
 
-    implements(ITextLineTest)
-
     def __init__(self):
         self.s1 = ''
         self.s2 = u'foo'

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_itemswidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_itemswidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_itemswidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,7 @@
 import unittest
 
 from zope.component.testing import PlacelessSetup
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.publisher.browser import TestRequest
 from zope.schema import Choice, List, Set, FrozenSet
 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
@@ -69,8 +69,8 @@
         required=False)
 
 
+ at implementer(ICollector)
 class Collector(object):
-    implements(ICollector)
 
     def __init__(self, numbers=None):
         self.numbers = numbers or []
@@ -159,8 +159,8 @@
         vocabulary=containerVocab,
         required=True)
 
+ at implementer(ITestContainer)
 class TestContainer(object):
-    implements(ITestContainer)
 
     def __init__(self, container=None):
         self.container = container

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_multicheckboxwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_multicheckboxwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_multicheckboxwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 import doctest
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.publisher.browser import TestRequest
 from zope.schema import Choice, List
 
@@ -41,8 +41,9 @@
                     description=desc,
                     value_type=Choice(values=[u'foo', u'bar'])
                     )
+        @implementer(ITestContent)
         class TestObject(object):
-            implements(ITestContent)
+            pass
 
         self.content = TestObject()
         field = ITestContent['foo']

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_objectwidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_objectwidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_objectwidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -16,7 +16,7 @@
 import unittest
 import sys
 from zope.component import testing
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.publisher.browser import TestRequest
 from zope.schema import Object, TextLine
 from zope.schema.interfaces import ITextLine
@@ -33,11 +33,12 @@
     name = TextLine()
     email = TextLine()
     
+ at implementer(ITestContact)
 class TestContact(object):
-    implements(ITestContact)
+    pass
 
+ at implementer(IWidgetInputErrorView)
 class ObjectWidgetInputErrorView(object):
-    implements(IWidgetInputErrorView)
 
     def __init__(self, error, request):
         self.error = error
@@ -69,8 +70,9 @@
                     title=title,
                     description=desc
                     )
+        @implementer(ITestContent)
         class TestObject(object):
-            implements(ITestContent)
+            pass
 
         self.content = TestObject()
         self.field = ITestContent['foo']

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_radiowidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_radiowidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_radiowidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -15,7 +15,7 @@
 """
 import unittest
 import doctest
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.interface.verify import verifyClass
 from zope.publisher.browser import TestRequest
 from zope.schema import Choice
@@ -41,8 +41,9 @@
                     description=desc,
                     values=(u'foo', u'bar')
                     )
+        @implementer(ITestContent)
         class TestObject(object):
-            implements(ITestContent)
+            pass
 
         self.content = TestObject()
         field = ITestContent['foo']

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_registrations.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_registrations.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_registrations.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -17,7 +17,7 @@
 
 from zope.component import getMultiAdapter
 from zope.configuration import xmlconfig
-from zope.interface import implements
+from zope.interface import implementer
 from zope.publisher.browser import TestRequest
 from doctest import DocTestSuite
 
@@ -36,15 +36,17 @@
 class ISampleObject(interfaces.IField):
     pass
 
+ at implementer(ISampleObject)
 class SampleObject(object):
-    implements(ISampleObject)
+    pass
 
 class ISampleVocabulary(interfaces.IVocabularyTokenized,
                         interfaces.IVocabulary):
     pass
 
+ at implementer(ISampleVocabulary)
 class SampleVocabulary(vocabulary.SimpleVocabulary):
-    implements(ISampleVocabulary)
+    pass
 
 request = TestRequest()
 sample = SampleObject()

Modified: zope.formlib/trunk/src/zope/formlib/tests/test_sequencewidget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/tests/test_sequencewidget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/tests/test_sequencewidget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -14,7 +14,7 @@
 """Sequence Field Widget tests.
 """
 import unittest
-from zope.interface import Interface, implements
+from zope.interface import Interface, implementer
 from zope.schema import Tuple, List, TextLine
 from zope.schema.interfaces import ITextLine
 from zope.component import provideAdapter
@@ -47,8 +47,9 @@
                     title=title,
                     description=desc,
                     )
+        @implementer(ITestContent)
         class TestObject(object):
-            implements(ITestContent)
+            pass
 
         self.content = TestObject()
         self.field = ITestContent['foo'].bind(self.content)

Modified: zope.formlib/trunk/src/zope/formlib/textwidgets.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/textwidgets.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/textwidgets.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -17,7 +17,7 @@
 
 import decimal
 from xml.sax import saxutils
-from zope.interface import implements
+from zope.interface import implementer
 from zope.datetime import parseDatetimetz
 from zope.datetime import DateTimeError
 from zope.i18n.format import DateTimeParseError
@@ -34,6 +34,7 @@
         str = saxutils.escape(str)
     return str
 
+ at implementer(ITextBrowserWidget)
 class TextWidget(SimpleInputWidget):
     """Text widget.
 
@@ -103,8 +104,6 @@
       />
     """
 
-    implements(ITextBrowserWidget)
-
     default = ''
     displayWidth = 20
     displayMaxWidth = ""
@@ -523,8 +522,8 @@
                 raise ConversionError(_("Invalid integer data"), v)
 
 
+ at implementer(IInputWidget)
 class FloatWidget(TextWidget):
-    implements(IInputWidget)
     displayWidth = 10
 
     def _toFieldValue(self, input):
@@ -536,8 +535,8 @@
             except ValueError, v:
                 raise ConversionError(_("Invalid floating point data"), v)
 
+ at implementer(IInputWidget)
 class DecimalWidget(TextWidget):
-    implements(IInputWidget)
     displayWidth = 10
 
     def _toFieldValue(self, input):

Modified: zope.formlib/trunk/src/zope/formlib/widget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/widget.py	2012-05-18 14:12:40 UTC (rev 126108)
+++ zope.formlib/trunk/src/zope/formlib/widget.py	2012-05-18 14:37:15 UTC (rev 126109)
@@ -18,7 +18,7 @@
 from xml.sax.saxutils import quoteattr, escape
 
 from zope.component import getMultiAdapter, provideAdapter
-from zope.interface import implements
+from zope.interface import implementer
 from zope.schema.interfaces import ValidationError
 from zope.publisher.browser import BrowserView
 from zope.publisher.interfaces.browser import IDefaultBrowserLayer
@@ -44,11 +44,10 @@
             data, {'\n': '&#10;', '\r': '&#13;', '\t':'&#9;'})
 
 
+ at implementer(IWidget)
 class Widget(object):
     """Mixin class providing functionality common across widget types."""
 
-    implements(IWidget)
-
     _prefix = 'field.'
     _data_marker = object()
     _data = _data_marker
@@ -103,9 +102,9 @@
             return False
 
 
+ at implementer(IWidgetFactory)
 class CustomWidgetFactory(object):
     """Custom Widget Factory."""
-    implements(IWidgetFactory)
 
     def __init__(self, widget_factory, *args, **kw):
         self._widget_factory = widget_factory
@@ -133,6 +132,7 @@
 
         return self._create(args)
 
+ at implementer(IBrowserWidget)
 class BrowserWidget(Widget, BrowserView):
     """Base class for browser widgets.
 
@@ -167,8 +167,8 @@
     illustrate, we can create and register a simple error display view:
 
         >>> from zope.formlib.interfaces import IWidgetInputError
-        >>> class SnippetErrorView:
-        ...     implements(IWidgetInputErrorView)
+        >>> @implementer(IWidgetInputErrorView)
+        ... class SnippetErrorView:
         ...     def __init__(self, context, request):
         ...         self.context = context
         ...     def snippet(self):
@@ -190,8 +190,6 @@
 
     """
 
-    implements(IBrowserWidget)
-
     _error = None
 
     def __init__(self, context, request):
@@ -208,6 +206,7 @@
         return ""
 
 
+ at implementer(ISimpleInputWidget)
 class SimpleInputWidget(BrowserWidget, InputWidget):
     """A baseclass for simple HTML form widgets.
 
@@ -373,8 +372,6 @@
     >>> tearDown()
     """
 
-    implements(ISimpleInputWidget)
-
     tag = u'input'
     type = u'text'
     cssClass = u''



More information about the Zope3-Checkins mailing list