[Zope3-Users] Using homefolder in a TALES expression

Simon Elbaz elbazsimon9 at gmail.com
Thu Jul 9 12:11:43 EDT 2009


Hi,
I'm trying to reproduce the example given in
zope.app.homefolder/trunk/src/zope/app/homefolder/README.txt and I have some
difficulties to understand. The error traceback seems to say that principal
cannot be traversed to the homefolder.

The used template test_homefolder.pt looks like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>PageletTestLayout</title>
</head>
<body>
<p
   tal:content="request/principal/homefolder">
</p>
</body>
</html>

In configure.zcml:
<z3c:pagelet
      name="search_display.html"
      for="zope.app.folder.interfaces.IFolder"
      permission="adama.site_access"
      layer="z3c.layer.pagelet.IPageletBrowserLayer"
      class=".login.SearchAddForm"
/>

<z3c:layout
        for=".login.SearchAddForm"
        layer="z3c.layer.pagelet.IPageletBrowserLayer"
        template="test_homefolder.pt"
/>

Traceback:
  File
"/home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/tales.py",
line 696, in evaluate
    return expression(self)
   - /home/simon/ADAMA/Src/gui/z3c_auth/src/z3c_auth/browser/
test_homefolder.pt
   - Line 10, Column 0
   - Expression: <PathExpr standard:u'request/principal/homefolder'>
   - Names:
      {'args': (),
       'context': <zope.site.folder.Folder object at 0x90da9ec>,
       'default': <object object at 0xb7ded728>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <zope.publisher.browser.BrowserRequest instance URL=
http://localhost:9060/++skin++PageletTestSkin/mysite/@@search.html>,
       'template': <z3c.ptcompat.ViewPageTemplateFile object at 0x97ab42c>,
       'view': <zope.app.publisher.browser.viewmeta.SearchAddForm object at
0x9c2566c>,
       'views': <zope.app.pagetemplate.viewpagetemplatefile.ViewMapper
object at 0x9c25dec>}
  File
"/home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/expressions.py",
line 217, in __call__
    return self._eval(econtext)
  File
"/home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/expressions.py",
line 194, in _eval
    ob = self._subexprs[-1](econtext)
  File
"/home/simon/.buildout/eggs/zope.tales-3.4.0-py2.5.egg/zope/tales/expressions.py",
line 124, in _eval
    ob = self._traverser(ob, element, econtext)
  File
"/home/simon/.buildout/eggs/zope.pagetemplate-3.5.0-py2.5.egg/zope/pagetemplate/engine.py",
line 68, in __call__
    request=request)
  File
"/home/simon/.buildout/eggs/zope.traversing-3.7.1-py2.5.egg/zope/traversing/adapters.py",
line 139, in traversePathElement
    return traversable.traverse(nm, further_path)
   - __traceback_info__: (Principal(u'users.a'), 'homefolder')
  File
"/home/simon/.buildout/eggs/zope.traversing-3.7.1-py2.5.egg/zope/traversing/adapters.py",
line 53, in traverse
    raise LocationError(subject, name)
   - __traceback_info__: (Principal(u'users.a'), 'homefolder', [])
LocationError: (Principal(u'users.a'), 'homefolder')

Thanks for any help
Simon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-users/attachments/20090709/095bc7c5/attachment.html 


More information about the Zope3-users mailing list