|
|
|
Issue 3 of
pushpage Issues
[pushpage]
|
| Title: |
ZCML-driven view incompatible with Zope 3.3.0rc1
|
| Status: |
Resolved
|
Security |
related:
No
|
| Description: |
After adding the meta.zcml, Kevin reports:
It works great when I use the factory method and display it
through a browser view. However I'm gettin...
|
| From: |
tseaver
|
on: |
Sep 16, 06 22:01
|
| |
tseaver
|
Last update:
|
Sep 16, 06 22:01
|
| Topic/class: |
API/bug
|
Importance:
|
medium
|
| Version info: |
0.1 |
|
Issue 3 Transcript
|
|
3 entries
|
= Resolve - Entry #3 by tseaver on Sep 16, 2006 10:07 pm
Status: Pending => Resolved
Fix checked in for pushpage-0.2.
________________________________________
= Comment - Entry #2 by tseaver on Sep 16, 2006 10:06 pm
It appears that the 'PushPage' view class needs to
implement 'IBrowserPublisher' in order to avoid default
view lookup hassles, and maybe to get the '__parent__'
set properly.
The attached patch makes the page render properly
against the current Zope3 trunk.
--- browser.py 19 Mar 2006 21:04:27 -0000 1.4
+++ browser.py 17 Sep 2006 01:43:44 -0000
@@ -3,7 +3,9 @@
$Id: browser.py,v 1.4 2006/03/19 21:04:27 tseaver Exp $
"""
+from zope.interface import implements
from zope.pagetemplate.pagetemplate import PageTemplate
+from zope.publisher.interfaces.browser import IBrowserPublisher
class PushPageTemplate(PageTemplate):
@@ -27,6 +29,7 @@
return page
class PushPage:
+ implements(IBrowserPublisher)
def __init__(self, context, request, template, mapper):
self.context = context
@@ -34,5 +37,14 @@
self.template = template
self.mapper = mapper
+ def browserDefault(self, request):
+ return self, ()
+
+ def publishTraverse(self, request, name):
+ if name == 'index.html':
+ return self.index
+
+ raise NotFound(self, name, request)
+
def __call__(self):
return self.template(**self.mapper(self.context, self.request))
________________________________________
= Request - Entry #1 by tseaver on Sep 16, 2006 10:01 pm
After adding the meta.zcml, Kevin reports:
It works great when I use the factory method and display it
through a browser view. However I'm getting an interesting
getParent not found error when trying display using the
pushpage directive:
2006-09-16T17:04:17 ERROR SiteError http://localhost:8080/@@pushpage.html/@@singleBranchTree.xml
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line 133, in publish
result = publication.callObject(request, obj)
File "C:\Python24\Lib\site-packages\zope\app\publication\zopepublication.py",
line 161, in callObject
return mapply(ob, request.getPositionalArguments(), request)
File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line 108, in mapply
return debug_call(obj, args)
- __traceback_info__: <bound method XmlObjectView.singleBranchTree of <zope.a
pp.publisher.browser.viewmeta.XmlObjectView object at 0x0342E5D0>>
File "C:\Python24\Lib\site-packages\zope\publisher\publish.py", line 114, in debug_call
return obj(*args)
File "C:\Python24\Lib\site-packages\zope\app\rotterdam\xmlobject.py", line 229
, in singleBranchTree
parent = getParent(self.context)
File "C:\Python24\Lib\site-packages\zope\traversing\api.py", line 140, in getParent
raise TypeError("Not enough context information to get parent", obj)
TypeError: ('Not enough context information to get parent', <pushpage.browser.PushPage instance at 0x0345FB70>)
127.0.0.1 - - [16/Sep/2006:17:04:17 -0700] "GET /@@pushpage.html/@@singleBranchT
ree.xml HTTP/1.1" 500 84 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv
:1.8.0.7) Gecko/20060909 Firefox/1.5.0.7"
|
|
|