summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests/test_chameleon_zpt.py
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2009-09-20 22:13:11 +0000
committerChris McDonough <chrism@agendaless.com>2009-09-20 22:13:11 +0000
commite4610566d881f707c01d266a7e336084029c83e4 (patch)
tree0a2001361b14e5b0b7521164e67560e2763e4c3c /repoze/bfg/tests/test_chameleon_zpt.py
parent160f01439dc3e0d865b2e77bb4a9a7c9e7a16c1a (diff)
downloadpyramid-e4610566d881f707c01d266a7e336084029c83e4.tar.gz
pyramid-e4610566d881f707c01d266a7e336084029c83e4.tar.bz2
pyramid-e4610566d881f707c01d266a7e336084029c83e4.zip
- The way ``bfg_view`` declarations are scanned for has been modified.
This should have no external effects. - An object implementing the ``IRenderer`` interface (and ``ITemplateRenderer`, which is a subclass of ``IRenderer``) must now accept an extra ``system`` argument in its ``__call__`` method implementation. Values computed by the system (as opposed to by the view) are passed by the system in the ``system`` parameter, which will always be a dictionary. Keys in the dictionary include: ``view`` (the view object 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). Previously only ITemplateRenderers received system arguments as elements inside the main ``value`` dictionary.
Diffstat (limited to 'repoze/bfg/tests/test_chameleon_zpt.py')
-rw-r--r--repoze/bfg/tests/test_chameleon_zpt.py19
1 files changed, 6 insertions, 13 deletions
diff --git a/repoze/bfg/tests/test_chameleon_zpt.py b/repoze/bfg/tests/test_chameleon_zpt.py
index f6d7c0da5..381a1d0bf 100644
--- a/repoze/bfg/tests/test_chameleon_zpt.py
+++ b/repoze/bfg/tests/test_chameleon_zpt.py
@@ -9,12 +9,6 @@ class Base(object):
def tearDown(self):
cleanUp()
- def _zcmlConfigure(self):
- import repoze.bfg.includes
- import zope.configuration.xmlconfig
- zope.configuration.xmlconfig.file('configure.zcml',
- package=repoze.bfg.includes)
-
def _getTemplatePath(self, name):
import os
here = os.path.abspath(os.path.dirname(__file__))
@@ -41,16 +35,19 @@ class ZPTTemplateRendererTests(Base, unittest.TestCase):
verifyClass(ITemplateRenderer, self._getTargetClass())
def test_call(self):
- self._zcmlConfigure()
minimal = self._getTemplatePath('minimal.pt')
instance = self._makeOne(minimal)
- result = instance({})
+ result = instance({}, {})
self.failUnless(isinstance(result, unicode))
self.assertEqual(result,
'<div xmlns="http://www.w3.org/1999/xhtml">\n</div>')
+ def test_call_with_nondict_value(self):
+ minimal = self._getTemplatePath('minimal.pt')
+ instance = self._makeOne(minimal)
+ self.assertRaises(ValueError, instance, None, {})
+
def test_implementation(self):
- self._zcmlConfigure()
minimal = self._getTemplatePath('minimal.pt')
instance = self._makeOne(minimal)
result = instance.implementation()()
@@ -65,7 +62,6 @@ class RenderTemplateTests(Base, unittest.TestCase):
return render_template(name, **kw)
def test_it(self):
- self._zcmlConfigure()
minimal = self._getTemplatePath('minimal.pt')
result = self._callFUT(minimal)
self.failUnless(isinstance(result, unicode))
@@ -78,7 +74,6 @@ class RenderTemplateToResponseTests(Base, unittest.TestCase):
return render_template_to_response(name, **kw)
def test_it(self):
- self._zcmlConfigure()
minimal = self._getTemplatePath('minimal.pt')
result = self._callFUT(minimal)
from webob import Response
@@ -149,7 +144,6 @@ class GetTemplateTests(Base, unittest.TestCase):
return get_template(name)
def test_nonabs_registered(self):
- self._zcmlConfigure()
from zope.component import getGlobalSiteManager
from zope.component import queryUtility
from repoze.bfg.chameleon_zpt import ZPTTemplateRenderer
@@ -163,7 +157,6 @@ class GetTemplateTests(Base, unittest.TestCase):
self.assertEqual(queryUtility(ITemplateRenderer, minimal), utility)
def test_nonabs_unregistered(self):
- self._zcmlConfigure()
from zope.component import getGlobalSiteManager
from zope.component import queryUtility
from repoze.bfg.chameleon_zpt import ZPTTemplateRenderer