diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-11-07 10:47:28 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-11-07 10:47:28 +0000 |
| commit | deb0dc316b64d5fb7bd0e15a1bafe269d3b33fbc (patch) | |
| tree | 669d3eb3f6d00ce866b1d48fc977ca372aebc396 /repoze/bfg/interfaces.py | |
| parent | 569ba5128fb1fd028e0fe879e810f855a61c8a03 (diff) | |
| download | pyramid-deb0dc316b64d5fb7bd0e15a1bafe269d3b33fbc.tar.gz pyramid-deb0dc316b64d5fb7bd0e15a1bafe269d3b33fbc.tar.bz2 pyramid-deb0dc316b64d5fb7bd0e15a1bafe269d3b33fbc.zip | |
Features
- Added a ``repoze.bfg.testing`` module to attempt to make it
slightly easier to write unittest-based automated tests of BFG
applications. Information about this class is in the
documentation.
- The default template renderer now supports testing better by
looking for ``ITestingTemplateRenderer`` using a relative
pathname. This is exposed indirectly through the API named
``registerTemplate`` in ``repoze.bfg.testing``.
Deprecations
- The names ``repoze.bfg.interfaces.ITemplate`` ,
``repoze.bfg.interfaces.ITemplateFactory`` and
``repoze.bfg.interfaces.INodeTemplate`` have been deprecated.
These should now be imported as
``repoze.bfg.interfaces.ITemplateRenderer`` and
``repoze.bfg.interfaces.ITemplateRendererFactory``, and
``INodeTemplateRenderer`` respectively.
- The name ``repoze.bfg.chameleon_zpt.ZPTTemplateFactory`` is
deprecated. Use ``repoze.bfg.chameleon_zpt.ZPTTemplateRenderer``.
- The name ``repoze.bfg.chameleon_genshi.GenshiTemplateFactory`` is
deprecated. Use
``repoze.bfg.chameleon_genshi.GenshiTemplateRenderer``.
- The name ``repoze.bfg.xslt.XSLTemplateFactory`` is deprecated.
Use ``repoze.bfg.xslt.XSLTemplateRenderer``.
Diffstat (limited to 'repoze/bfg/interfaces.py')
| -rw-r--r-- | repoze/bfg/interfaces.py | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/repoze/bfg/interfaces.py b/repoze/bfg/interfaces.py index bbff9bca7..71ef619c2 100644 --- a/repoze/bfg/interfaces.py +++ b/repoze/bfg/interfaces.py @@ -1,5 +1,6 @@ from zope.interface import Interface from zope.interface import Attribute +from zope.deprecation import deprecated from zope.component.interfaces import IObjectEvent @@ -26,20 +27,47 @@ class ITraverser(Interface): class ITraverserFactory(Interface): def __call__(context): - """ Return an object that implements IPublishTraverser """ + """ Return an object that implements ITraverser """ -class ITemplateFactory(Interface): - def __call__(path, auto_reload=False): - """ Return an an ITemplate given a filesystem path """ +class ITemplateRenderer(Interface): + 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 """ + + def __call__(**kw): + """ Call a the template implementation with the keywords + passed in as arguments and return the result (a string or + unicode object) """ -class ITemplate(Interface): +class ITestingTemplateRenderer(Interface): def __call__(**kw): - """ Return a string result given a template path """ + """ Accept keywords and process for test comparison purposes + (usually set all keywords as attributes of self); return value + is a string """ -class INodeTemplate(Interface): +class ITemplateRendererFactory(Interface): + def __call__(path, auto_reload=False): + """ Return an object that implements ``ITemplateRenderer`` """ + +class INodeTemplateRenderer(Interface): def __call__(node, **kw): - """ Return a string result given a template path """ - + """ Return a string result given a node and a template path """ + +ITemplate = ITemplateRenderer +deprecated('ITemplate', + ('repoze.bfg.interfaces.ITemplate should now be imported ' + 'as repoze.bfg.interfaces.ITemplateRenderer')) +INodeTemplate = INodeTemplateRenderer +deprecated('INodeTemplate', + ('repoze.bfg.interfaces.INodeTemplate should now be imported ' + 'as repoze.bfg.interfaces.INodeTemplateRenderer')) +ITemplateFactory = ITemplateRendererFactory +deprecated('ITemplateFactory', + ('repoze.bfg.interfaces.ITemplateFactory should now be imported ' + 'as repoze.bfg.interfaces.ITemplateRendererFactory')) + class ISecurityPolicy(Interface): """ A utility that provides a mechanism to check authorization using authentication data """ |
