[Grok-dev] megrok.resourcelibrary, zope.app.homefolder -> TraversalError

Christian Klinger cklinger at novareto.de
Thu Dec 11 10:42:02 EST 2008


Hi

i try to use in a grok application the two libraries 
megrok.resourcelibrary [1] and zope.app.homefolder [2].

I get my resource files with help of the megrok.resourcelibrary.
I included this in my *Master Macro*.


This works pretty nice so far. But when I try to access
my resources in the context of an instance of zope.app.homefolder
i got an error. You can see the traceback at the end of this post.

I access the homefolder thourgh an traverse method of my Application.

     def traverse(self, name):
         """ Custom Travers Method For the HomeFolders """
         if name=="members":
             utility = getUtility(IHomeFolderManager)
             return utility.homeFolderBase

The homeFolderBase is a grok.Container. This works if i not work with 
macros in the grok.View for this container.

I hope you have an idea for me.

Thanks for your help

-Christian

[1] http://pypi.python.org/pypi/megrok.resourcelibrary/0.9.2
[2] http://pypi.python.org/pypi/zope.app.homefolder/3.4.0

Traceback:

2008-12-11T16:11:13 ERROR SiteError 
http://localhost:8080/extranet/members/zope.manager/@@index
Traceback (most recent call last):
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.publisher-3.4.6-py2.4.egg/zope/publisher/publish.py", 
line 133, in publish
     result = publication.callObject(request, obj)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grok-0.14-py2.4.egg/grok/publication.py", 
line 45, in callObject
     return super(ZopePublicationSansProxy, self).callObject(request, ob)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.app.publication-3.4.3-py2.4.egg/zope/app/publication/zopepublication.py", 
line 167, in callObject
     return mapply(ob, request.getPositionalArguments(), request)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.publisher-3.4.6-py2.4.egg/zope/publisher/publish.py", 
line 108, in mapply
     return debug_call(obj, args)
    - __traceback_info__: <uvcsite.homefolder.homefolder.HomeFolderIndex 
object at 0x29535f0>
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.publisher-3.4.6-py2.4.egg/zope/publisher/publish.py", 
line 114, in debug_call
     return obj(*args)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grokcore.view-1.1-py2.4.egg/grokcore/view/components.py", 
line 59, in __call__
     return self._render_template()
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grokcore.view-1.1-py2.4.egg/grokcore/view/components.py", 
line 63, in _render_template
     return self.template.render(self)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grokcore.view-1.1-py2.4.egg/grokcore/view/components.py", 
line 219, in render
     return template.pt_render(namespace)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.pagetemplate-3.4.0-py2.4.egg/zope/pagetemplate/pagetemplate.py", 
line 115, in pt_render
     strictinsert=0, sourceAnnotations=sourceAnnotations)()
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 271, in __call__
     self.interpret(self.program)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 346, in interpret
     handlers[opcode](self, args)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 891, in do_useMacro
     self.interpret(macro)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 346, in interpret
     handlers[opcode](self, args)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 536, in do_optTag_tal
     self.do_optTag(stuff)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 521, in do_optTag
     return self.no_tag(start, program)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 516, in no_tag
     self.interpret(program)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 346, in interpret
     handlers[opcode](self, args)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 745, in do_insertStructure_tal
     structure = self.engine.evaluateStructure(expr)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tales-3.4.0-py2.4.egg/zope/tales/tales.py", 
line 696, in evaluate
     return expression(self)
    - 
/Users/cklinger/work/uvc/uvcsite/src/uvcsite/skin/skin_templates/uvcsitemacros.pt
    - Line 24, Column 7
    - Expression: <StringExpr u'uvcsite.logo'>
    - Names:
       {'args': (),
        'context': <uvcsite.homefolder.homefolder.HomeFolder object at 
0x2b792b0>,
        'default': <object object at 0x44550>,
        'loop': {},
        'nothing': None,
        'options': {},
        'repeat': {},
        'request': <zc.resourcelibrary.publication.Request instance 
URL=http://localhost:8080/extranet/members/zope.manager/@@index>,
        'static': <grokcore.view.components.DirectoryResource object at 
0x29538f0>,
        'template': <grokcore.view.components.TrustedFilePageTemplate 
object at 0x28d5870>,
        'view': <uvcsite.homefolder.homefolder.HomeFolderIndex object at 
0x29535f0>}
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.contentprovider-3.4.0-py2.4.egg/zope/contentprovider/tales.py", 
line 80, in __call__
     return provider.render()
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grok-0.14-py2.4.egg/grok/components.py", 
line 365, in render
     return u'\n'.join([viewlet.render() for viewlet in self.viewlets])
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grok-0.14-py2.4.egg/grok/components.py", 
line 402, in render
     return self.template.render(self)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/grokcore.view-1.1-py2.4.egg/grokcore/view/components.py", 
line 219, in render
     return template.pt_render(namespace)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.pagetemplate-3.4.0-py2.4.egg/zope/pagetemplate/pagetemplate.py", 
line 115, in pt_render
     strictinsert=0, sourceAnnotations=sourceAnnotations)()
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 271, in __call__
     self.interpret(self.program)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 346, in interpret
     handlers[opcode](self, args)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 379, in do_startEndTag
     self.do_startTag(stuff, self.endsep, self.endlen)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 408, in do_startTag
     rendered = attrAction(self, item)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tal-3.4.1-py2.4.egg/zope/tal/talinterpreter.py", 
line 485, in attrAction_tal
     evalue = self.engine.evaluateText(item[3])
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tales-3.4.0-py2.4.egg/zope/tales/tales.py", 
line 704, in evaluateText
     text = self.evaluate(expr)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tales-3.4.0-py2.4.egg/zope/tales/tales.py", 
line 696, in evaluate
     return expression(self)
    - 
/Users/cklinger/work/uvc/uvcsite/src/uvcsite/viewlets/viewlets_templates/image.pt
    - Line 2, Column 2
    - Expression: <PathExpr standard:u'context/@@/uvcresources/uvc.png'>
    - Names:
       {'args': (),
        'context': <uvcsite.homefolder.homefolder.HomeFolder object at 
0x2b792b0>,
        'default': <object object at 0x44550>,
        'loop': {},
        'nothing': None,
        'options': {},
        'repeat': {},
        'request': <zc.resourcelibrary.publication.Request instance 
URL=http://localhost:8080/extranet/members/zope.manager/@@index>,
        'static': <grokcore.view.components.DirectoryResource object at 
0x2b7e430>,
        'template': <grokcore.view.components.TrustedFilePageTemplate 
object at 0x293c310>,
        'view': <uvcsite.homefolder.homefolder.HomeFolderIndex object at 
0x29535f0>,
        'viewlet': <uvcsite.viewlets.viewlets.Image object at 0x2b7e3d0>,
        'viewletmanager': <uvcsite.viewlets.managers.Logo object at 
0x2b7e3b0>}
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tales-3.4.0-py2.4.egg/zope/tales/expressions.py", 
line 217, in __call__
     return self._eval(econtext)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tales-3.4.0-py2.4.egg/zope/tales/expressions.py", 
line 194, in _eval
     ob = self._subexprs[-1](econtext)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.tales-3.4.0-py2.4.egg/zope/tales/expressions.py", 
line 124, in _eval
     ob = self._traverser(ob, element, econtext)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.app.pagetemplate-3.4.1-py2.4.egg/zope/app/pagetemplate/engine.py", 
line 68, in __call__
     request=request)
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.traversing-3.4.1-py2.4.egg/zope/traversing/adapters.py", 
line 164, in traversePathElement
     return traversable.traverse(nm, further_path)
    - __traceback_info__: 
({'zope.app.security.AnnotationPrincipalRoleManager': 
<zope.securitypolicy.securitymap.PersistentSecurityMap object at 
0x2b793b0>}, 'uvcresources')
   File 
"/Users/cklinger/work/uvc/uvcsite/eggs/zope.traversing-3.4.1-py2.4.egg/zope/traversing/adapters.py", 
line 52, in traverse
     raise TraversalError(subject, name)
    - __traceback_info__: 
({'zope.app.security.AnnotationPrincipalRoleManager': 
<zope.securitypolicy.securitymap.PersistentSecurityMap object at 
0x2b793b0>}, 'uvcresources', ['uvc.png'])
TraversalError: ({'zope.app.security.AnnotationPrincipalRoleManager': 
<zope.securitypolicy.securitymap.PersistentSecurityMap object at 
0x2b793b0>}, 'uvcresources')
^C



More information about the Grok-dev mailing list