Chris McDonough
2010-11-22 e269038f5328f80edaa7cceb73b8a176204ecc63
- Add ``pyramid.interfaces.ITemplateRenderer`` interface to Interfaces API
chapter (has ``implementation()`` method, required to be used when getting
at Chameleon macros).
3 files modified
45 ■■■■■ changed files
CHANGES.txt 4 ●●●● patch | view | raw | blame | history
docs/api/interfaces.rst 1 ●●●● patch | view | raw | blame | history
pyramid/interfaces.py 40 ●●●● patch | view | raw | blame | history
CHANGES.txt
@@ -26,6 +26,10 @@
- SQLAlchemy+URLDispatch tutorial updated to integrate changes to
  ``pyramid_routesalchemy`` template.
- Add ``pyramid.interfaces.ITemplateRenderer`` interface to Interfaces API
  chapter (has ``implementation()`` method, required to be used when getting
  at Chameleon macros).
1.0a4 (2010-11-21)
==================
docs/api/interfaces.rst
@@ -33,4 +33,5 @@
  .. autointerface:: IRendererInfo
  .. autointerface:: ITemplateRenderer
pyramid/interfaces.py
@@ -100,6 +100,26 @@
        """ Return the value for key ``k`` from the renderer globals
        dictionary, or the default if no such value exists."""
class IRenderer(Interface):
    def __call__(value, system):
        """ Call a the renderer implementation with the result of the
        view (``value``) passed in and return a result (a string or
        unicode object useful as a response body).  Values computed by
        the system are passed by the system in the ``system``
        parameter, which is a dictionary.  Keys in the dictionary
        include: ``view`` (the view callable that returned the value),
        ``renderer_name`` (the template name or simple name of the
        renderer), ``context`` (the context object passed to the
        view), and ``request`` (the request object passed to the
        view)."""
class ITemplateRenderer(IRenderer):
    def implementation():
        """ Return the object that the underlying templating system
        uses to render the template; it is typically a callable that
        accepts arbitrary keyword arguments and returns a string or
        unicode object """
# internal interfaces
class IRequest(Interface):
@@ -233,19 +253,6 @@
ITraverserFactory = ITraverser # b / c for 1.0 code
class IRenderer(Interface):
    def __call__(value, system):
        """ Call a the renderer implementation with the result of the
        view (``value``) passed in and return a result (a string or
        unicode object useful as a response body).  Values computed by
        the system are passed by the system in the ``system``
        parameter, which is a dictionary.  Keys in the dictionary
        include: ``view`` (the view callable that returned the value),
        ``renderer_name`` (the template name or simple name of the
        renderer), ``context`` (the context object passed to the
        view), and ``request`` (the request object passed to the
        view)."""
class IRendererFactory(Interface):
    def __call__(name):
        """ Return an object that implements ``IRenderer``  """
@@ -258,13 +265,6 @@
        key, indicating the current request, and the value
        ``renderer_name``, which will be the name of the renderer in
        use."""
class ITemplateRenderer(IRenderer):
    def implementation():
        """ Return the object that the underlying templating system
        uses to render the template; it is typically a callable that
        accepts arbitrary keyword arguments and returns a string or
        unicode object """
class IViewPermission(Interface):
    def __call__(context, request):