TODO.txt | ●●●●● patch | view | raw | blame | history | |
docs/narr/hooks.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/resources.rst | ●●●●● patch | view | raw | blame | history | |
docs/narr/traversal.rst | ●●●●● patch | view | raw | blame | history |
TODO.txt
@@ -15,9 +15,6 @@ Nice-to-Have ------------ - Replace all mentions of zope.interface.implements with zope.interface.implementer. - Put includes in development.ini on separate lines and fix project.rst to tell people to comment out only the debugtoolbar include when they want to disable. docs/narr/hooks.rst
@@ -606,24 +606,24 @@ If you want to implement your own Response object instead of using the :class:`pyramid.response.Response` object in any capacity at all, you'll have to make sure the object implements every attribute and method outlined in :class:`pyramid.interfaces.IResponse` and you'll have to ensure that it's marked up with ``zope.interface.implements(IResponse)``: :class:`pyramid.interfaces.IResponse` and you'll have to ensure that it uses ``zope.interface.implementer(IResponse)`` as a class decoratoror. .. code-block:: python :linenos: from pyramid.interfaces import IResponse from zope.interface import implements from zope.interface import implementer @implementer(IResponse) class MyResponse(object): implements(IResponse) # ... an implementation of every method and attribute # documented in IResponse should follow ... When an alternate response object implementation is returned by a view callable, if that object asserts that it implements :class:`~pyramid.interfaces.IResponse` (via ``zope.interface.implements(IResponse)``) , an adapter needn't be registered ``zope.interface.implementer(IResponse)``) , an adapter needn't be registered for the object; Pyramid will use it directly. An IResponse adapter for ``webob.Response`` (as opposed to @@ -812,13 +812,14 @@ .. code-block:: python :linenos: from zope.interface import implementer from wsgiref.simple_server import make_server from pyramid.config import Configurator from mypackage.interfaces import IMyUtility @implementer(IMyUtility) class UtilityImplementation: implements(IMyUtility) def __init__(self): self.registrations = {} docs/narr/resources.rst
@@ -540,14 +540,14 @@ :linenos: import datetime from zope.interface import implements from zope.interface import implementer from zope.interface import Interface class IBlogEntry(Interface): pass @implementer(IBlogEntry) class BlogEntry(object): implements(IBlogEntry) def __init__(self, title, body, author): self.title = title self.body = body @@ -556,15 +556,15 @@ This resource consists of two things: the class which defines the resource constructor as the class ``BlogEntry``, and an :term:`interface` attached to the class via an ``implements`` statement at class scope using the ``IBlogEntry`` interface as its sole argument. the class via an ``implementer`` class decorator using the ``IBlogEntry`` interface as its sole argument. The interface object used must be an instance of a class that inherits from :class:`zope.interface.Interface`. A resource class may implement zero or more interfaces. You specify that a resource implements an interface by using the :func:`zope.interface.implements` function at class scope. The above :func:`zope.interface.implementer` function as a class decorator. The above ``BlogEntry`` resource implements the ``IBlogEntry`` interface. You can also specify that a particular resource *instance* provides an docs/narr/traversal.rst
@@ -488,20 +488,21 @@ with interface declarations that refer to this interface. To attach an interface to a resource *class*, you define the interface and use the :func:`zope.interface.implements` function to associate the interface with the class. use the :func:`zope.interface.implementer` class decorator to associate the interface with the class. .. code-block:: python :linenos: from zope.interface import Interface from zope.interface import implements from zope.interface import implementer class IHello(Interface): """ A marker interface """ @implementer(IHello) class Hello(object): implements(IHello) pass To attach an interface to a resource *instance*, you define the interface and use the :func:`zope.interface.alsoProvides` function to associate the