diff options
| -rw-r--r-- | CHANGES.txt | 4 | ||||
| -rw-r--r-- | docs/api/interfaces.rst | 1 | ||||
| -rw-r--r-- | pyramid/interfaces.py | 40 |
3 files changed, 25 insertions, 20 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 9fa66ce1f..9d9a9ee5a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -26,6 +26,10 @@ Documentation - 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) ================== diff --git a/docs/api/interfaces.rst b/docs/api/interfaces.rst index b27428d89..b3c14e5f7 100644 --- a/docs/api/interfaces.rst +++ b/docs/api/interfaces.rst @@ -33,4 +33,5 @@ Other Interfaces .. autointerface:: IRendererInfo + .. autointerface:: ITemplateRenderer diff --git a/pyramid/interfaces.py b/pyramid/interfaces.py index 9b895e020..f021ba60b 100644 --- a/pyramid/interfaces.py +++ b/pyramid/interfaces.py @@ -100,6 +100,26 @@ class IBeforeRender(Interface): """ 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 @@ class ITraverser(Interface): 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`` """ @@ -259,13 +266,6 @@ class IRendererGlobalsFactory(Interface): ``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): """ Return True if the permission allows, return False if it denies. """ |
