Assert that views of the form

  class MyView(BrowserView):

      __call__ = ViewPageTemplateFile('...')

work.
parent 0e27cc13
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
$Id$ $Id$
""" """
from Products.Five import BrowserView from Products.Five import BrowserView
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
class SimpleView(BrowserView): class SimpleView(BrowserView):
"""More docstring. Please Zope""" """More docstring. Please Zope"""
...@@ -39,6 +40,10 @@ class CallView(BrowserView): ...@@ -39,6 +40,10 @@ class CallView(BrowserView):
def __call__(self): def __call__(self):
return u"I was __call__()'ed" return u"I was __call__()'ed"
class CallTemplate(BrowserView):
__call__ = ViewPageTemplateFile('falcon.pt')
class CallableNoDocstring: class CallableNoDocstring:
def __call__(self): def __call__(self):
......
...@@ -161,6 +161,13 @@ ...@@ -161,6 +161,13 @@
permission="zope2.Public" permission="zope2.Public"
/> />
<browser:page
for="Products.Five.tests.testing.simplecontent.ISimpleContent"
class=".pages.CallTemplate"
name="calltemplate.html"
permission="zope2.Public"
/>
<!-- pages from methods/functions/callables that don't have docstrings --> <!-- pages from methods/functions/callables that don't have docstrings -->
<browser:pages <browser:pages
for="Products.Five.tests.testing.simplecontent.ISimpleContent" for="Products.Five.tests.testing.simplecontent.ISimpleContent"
......
...@@ -144,6 +144,14 @@ class bearing only a __call__ method: ...@@ -144,6 +144,14 @@ class bearing only a __call__ method:
... ...
I was __call__()'ed I was __call__()'ed
or a __call__ object that's callable, such as a ViewPageTemplateFile:
>>> print http(r'''
... GET /test_folder_1_/testoid/calltemplate.html HTTP/1.1
... ''')
HTTP/1.1 200 OK
...
<p>The falcon has taken flight</p>
Clean up Clean up
-------- --------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment