[Checkins] SVN: grok/branches/0.11/ Fix
https://bugs.launchpad.net/grok/+bug/161948: grok.testing.grok()
Philipp von Weitershausen
philikon at philikon.de
Sun Nov 11 06:07:19 EST 2007
Log message for revision 81744:
Fix https://bugs.launchpad.net/grok/+bug/161948: grok.testing.grok()
now also loads the ZPT template factories so that unit tests that
need to configure views with ZPT templates continue to work.
Changed:
U grok/branches/0.11/CHANGES.txt
U grok/branches/0.11/src/grok/testing.py
A grok/branches/0.11/src/grok/tests/template/zpt.py
A grok/branches/0.11/src/grok/tests/template/zpt_templates/
A grok/branches/0.11/src/grok/tests/template/zpt_templates/piepmatz.pt
U grok/branches/0.11/src/grok/tests/view/dirandinlinetemplate.py
U grok/branches/0.11/src/grok/tests/view/dirtemplate.py
U grok/branches/0.11/src/grok/tests/view/dirtemplateandrender.py
U grok/branches/0.11/src/grok/tests/view/dirtemplatesonly.py
U grok/branches/0.11/src/grok/tests/view/templatedirectory.py
U grok/branches/0.11/src/grok/tests/view/templatereload.py
U grok/branches/0.11/src/grok/tests/view/unassociated.py
U grok/branches/0.11/src/grok/tests/zcml/directivepackage.py
-=-
Modified: grok/branches/0.11/CHANGES.txt
===================================================================
--- grok/branches/0.11/CHANGES.txt 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/CHANGES.txt 2007-11-11 11:07:19 UTC (rev 81744)
@@ -7,7 +7,9 @@
Bug fixes
---------
-* ...
+* Fix https://bugs.launchpad.net/grok/+bug/161948: grok.testing.grok()
+ now also loads the ZPT template factories so that unit tests that
+ need to configure views with ZPT templates continue to work.
0.11 (2007-11-08)
=================
Modified: grok/branches/0.11/src/grok/testing.py
===================================================================
--- grok/branches/0.11/src/grok/testing.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/testing.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -20,6 +20,7 @@
def grok(module_name):
config = ConfigurationMachine()
zcml.do_grok('grok.meta', config)
+ zcml.do_grok('grok.templatereg', config)
zcml.do_grok(module_name, config)
config.execute_actions()
Added: grok/branches/0.11/src/grok/tests/template/zpt.py
===================================================================
--- grok/branches/0.11/src/grok/tests/template/zpt.py (rev 0)
+++ grok/branches/0.11/src/grok/tests/template/zpt.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -0,0 +1,22 @@
+"""
+
+ >>> grok.testing.grok(__name__)
+
+ >>> cave = Cave()
+ >>> from zope.publisher.browser import TestRequest
+ >>> request = TestRequest()
+ >>> from zope.component import getMultiAdapter
+
+ >>> view = getMultiAdapter((cave, request), name='piepmatz')
+ >>> print view()
+ <p>Piep! Piep!</p>
+
+"""
+
+import grok
+
+class Cave(grok.Model):
+ pass
+
+class Piepmatz(grok.View):
+ pass # template in zpt_templates/piepmatz.pt
Property changes on: grok/branches/0.11/src/grok/tests/template/zpt.py
___________________________________________________________________
Name: svn:eol-style
+ native
Added: grok/branches/0.11/src/grok/tests/template/zpt_templates/piepmatz.pt
===================================================================
--- grok/branches/0.11/src/grok/tests/template/zpt_templates/piepmatz.pt (rev 0)
+++ grok/branches/0.11/src/grok/tests/template/zpt_templates/piepmatz.pt 2007-11-11 11:07:19 UTC (rev 81744)
@@ -0,0 +1 @@
+<p>Piep! Piep!</p>
Property changes on: grok/branches/0.11/src/grok/tests/template/zpt_templates/piepmatz.pt
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: grok/branches/0.11/src/grok/tests/view/dirandinlinetemplate.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/dirandinlinetemplate.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/dirandinlinetemplate.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -2,7 +2,6 @@
If multiple templates can be found, one in the module and one in the
template directory, there is an error:
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
Traceback (most recent call last):
...
Modified: grok/branches/0.11/src/grok/tests/view/dirtemplate.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/dirtemplate.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/dirtemplate.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -1,7 +1,6 @@
"""
Templates can also be found in a directory with the same name as the module:
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
>>> manfred = Mammoth()
Modified: grok/branches/0.11/src/grok/tests/view/dirtemplateandrender.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/dirtemplateandrender.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/dirtemplateandrender.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -2,7 +2,6 @@
A View may either have an associated template or a render-method. Here
we check that this also works for templates in a template-directory:
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
Traceback (most recent call last):
...
Modified: grok/branches/0.11/src/grok/tests/view/dirtemplatesonly.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/dirtemplatesonly.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/dirtemplatesonly.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -6,7 +6,6 @@
>>> warnings.warn = warn
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
From tests.py's showwarning():
... UserWarning: File 'invalid.txt' has an unrecognized extension in directory '...dirtemplatesonly_templates'...
Modified: grok/branches/0.11/src/grok/tests/view/templatedirectory.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/templatedirectory.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/templatedirectory.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -1,7 +1,6 @@
"""
You can explicitly specify the template directory using grok.templatedir on module level:
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
>>> manfred = Mammoth()
Modified: grok/branches/0.11/src/grok/tests/view/templatereload.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/templatereload.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/templatereload.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -2,7 +2,6 @@
Filesystem-based templates, once grokked, can be changed. The change
will automatically be picked up, reloading Zope is not necessary.
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
>>> from zope.component import getMultiAdapter
>>> from zope.publisher.browser import TestRequest
Modified: grok/branches/0.11/src/grok/tests/view/unassociated.py
===================================================================
--- grok/branches/0.11/src/grok/tests/view/unassociated.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/view/unassociated.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -2,7 +2,6 @@
Templates that are not associated with a view class will provoke an
error:
- >>> grok.testing.grok('grok.templatereg')
>>> grok.testing.grok(__name__)
Traceback (most recent call last):
...
Modified: grok/branches/0.11/src/grok/tests/zcml/directivepackage.py
===================================================================
--- grok/branches/0.11/src/grok/tests/zcml/directivepackage.py 2007-11-11 11:03:15 UTC (rev 81743)
+++ grok/branches/0.11/src/grok/tests/zcml/directivepackage.py 2007-11-11 11:07:19 UTC (rev 81744)
@@ -3,14 +3,12 @@
>>> from zope.configuration import xmlconfig
>>> context = xmlconfig.file('meta.zcml', grok)
-Load the ZPT factory
- >>> grok.testing.grok('grok.templatereg')
-
>>> ignored = xmlconfig.string('''
... <configure
... xmlns="http://namespaces.zope.org/zope"
... xmlns:grok="http://namespaces.zope.org/grok"
... >
+ ... <grok:grok package="grok.templatereg"/>
... <grok:grok package="grok.tests.zcml.stoneage"/>
... </configure>''', context=context)
More information about the Checkins
mailing list