[Zope-CMF] __bobo_traverse__ problem
Geoff Davis
geoff@geoffdavis.net
Tue, 13 Aug 2002 11:36:24 -0400
Hi all--
I am building a portal tool to take care of some of the navigation and
validation involved in working with forms in plone. The goal is to create a
portal tool called portal_form that wraps a form in a URL like so:
http://myCMFSite/myObject/portal_form/myObjectEdit
where myObjectEdit is a page template with a form for editing myObject. The
main functionality of portal_form is embedded in its bobo_traverse method,
which intercepts page loads and calls validation scripts as necessary, etc.
I'm having what appear to be some acquisition-related problems with my
current setup and am wondering if anyone can help shed some light on what's
going on:
Here's a simplified version of what I'm building:
class FormTool(UniqueObject, SimpleItem):
id = 'portal_form'
meta_type= 'Plone Form Tool'
security = ClassSecurityInfo()
security.declarePublic('__bobo_traverse__')
# An implementation of __bobo_traverse__ that does nothing interesting
def __bobo_traverse__(self, REQUEST, name):
""" """
return getattr(self, name)
The FormTool gets registered with the portal in the same way as the other
Plone portal tools.
Here's the problem: I try loading http://myCMFSite/myObject/portal_form/foo
where foo is a page template that renders here/portal_properties/title (or
any other attribute in portal_properties), and I get the authorization
exception below. Any idea as to what gives?
A few things I have tried:
* From __bobo_traverse__ I can directly access portal_properties via
getattr, and can grab any attribute, so that's not the problem.
* Putting the __bobo_traverse__ return value in the acquisition context of
portal_form via __of__ doesn't help (e.g. replacing return gettattr(self,
name) with next = getattr(self, name); next = next.__of__(self))
I am mystified!
Geoff
Traceback (innermost last):
File C:\Program Files\Zope 2.5.1\lib\python\ZPublisher\Publish.py, line
150, in publish_module
File C:\Program Files\Zope 2.5.1\lib\python\ZPublisher\Publish.py, line
114, in publish
File C:\PROGRA~1\ZOPE25~1.1\lib\python\Zope\__init__.py, line 159, in
zpublisher_exception_hook
(Object: portal_form)
File C:\Program Files\Zope 2.5.1\lib\python\ZPublisher\Publish.py, line
98, in publish
File C:\PROGRA~1\ZOPE25~1.1\lib\python\ZPublisher\mapply.py, line 88, in
mapply
(Object: test)
File C:\Program Files\Zope 2.5.1\lib\python\ZPublisher\Publish.py, line
39, in call_object
(Object: test)
File C:\PROGRA~1\ZOPE25~1.1\lib\python\Shared\DC\Scripts\Bindings.py, line
252, in __call__
(Object: test)
File C:\PROGRA~1\ZOPE25~1.1\lib\python\Shared\DC\Scripts\Bindings.py, line
283, in _bindAndExec
(Object: test)
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\ZopePageTemplate.py, line 228, in
_exec
(Object: test)
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\PageTemplate.py, line 91, in
pt_render
(Object: test)
File C:\Program Files\Zope 2.5.1\lib\python\TAL\TALInterpreter.py, line
159, in __call__
File C:\Program Files\Zope 2.5.1\lib\python\TAL\TALInterpreter.py, line
192, in interpret
File C:\Program Files\Zope 2.5.1\lib\python\TAL\TALInterpreter.py, line
419, in do_insertText_tal
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\TALES.py, line 226, in evaluateText
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\TALES.py, line 217, in evaluate
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\Expressions.py, line 192, in
__call__
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\Expressions.py, line 182, in _eval
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\Expressions.py, line 141, in _eval
(Info: here)
File C:\Program Files\Zope
2.5.1\lib\python\Products\PageTemplates\Expressions.py, line 324, in
restrictedTraverse
(Object: portal_form)
(Info: {'path': ['portal_properties'], 'TraversalRequestNameStack': []})
Unauthorized: You are not allowed to access portal_properties in this
context
Geoff Davis
http://www.geoffdavis.net