[Zope3-Users] request/principal and PAU users

Riccardo Tonon riccardo.tonon at gmail.com
Tue Jul 11 11:06:39 EDT 2006


Hi,

I've implemented a site that uses both Principal (for external users)and 
PAU (for intranet users).

It use a customized skin and in the template.pt file I want to print out 
  the username.

The following line works if I'm connected as an external user (defined 
in principals.zcml)

	<b tal:context="request/principal/title">User</b>

but it raise an error when I'm connected as a PAU user.

	ForbiddenAttribute: ('id', Principal(u'ldap.tonon'))


I attached the complete Traceback error I get.

Please, does anyone have a solution?

Thank you,
Riccardo







-------------- next part --------------
Traceback (most recent call last):
  File "D:\home\Zope-3.2.1\src\zope\publisher\publish.py", line 133, in publish
    result = publication.callObject(request, obj)
  File "D:\home\Zope-3.2.1\src\zope\app\publication\zopepublication.py", line 161, in callObject
    return mapply(ob, request.getPositionalArguments(), request)
  File "D:\home\Zope-3.2.1\src\zope\publisher\publish.py", line 108, in mapply
    return debug_call(obj, args)
   - __traceback_info__: <bound method ZPTPageEval.index of <zope.app.publisher.browser.viewmeta.ZPTPageEval object at 0
  File "D:\home\Zope-3.2.1\src\zope\publisher\publish.py", line 114, in debug_call
    return obj(*args)
  File "D:\home\Zope-3.2.1\src\zope\app\zptpage\browser\zptpage.py", line 29, in index
    return template.render(request, **kw)
  File "D:\home\Zope-3.2.1\src\zope\app\zptpage\zptpage.py", line 92, in render
    sourceAnnotations=debug_flags.sourceAnnotations)
  File "D:\home\Zope-3.2.1\src\zope\pagetemplate\pagetemplate.py", line 117, in pt_render
    strictinsert=0, sourceAnnotations=sourceAnnotations)()
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 276, in __call__
    self.interpret(self.program)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 351, in interpret
    handlers[opcode](self, args)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 907, in do_useMacro
    self.interpret(macro)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 351, in interpret
    handlers[opcode](self, args)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 537, in do_optTag_tal
    self.do_optTag(stuff)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 522, in do_optTag
    return self.no_tag(start, program)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 517, in no_tag
    self.interpret(program)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 351, in interpret
    handlers[opcode](self, args)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 966, in do_defineSlot
    self.interpret(slot)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 351, in interpret
    handlers[opcode](self, args)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 907, in do_useMacro
    self.interpret(macro)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 351, in interpret
    handlers[opcode](self, args)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 537, in do_optTag_tal
    self.do_optTag(stuff)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 522, in do_optTag
    return self.no_tag(start, program)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 517, in no_tag
    self.interpret(program)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 351, in interpret
    handlers[opcode](self, args)
  File "D:\home\Zope-3.2.1\src\zope\tal\talinterpreter.py", line 838, in do_loop_tal
    iterator = self.engine.setRepeat(name, expr)
  File "D:\home\Zope-3.2.1\src\zope\tales\tales.py", line 682, in setRepeat
    expr = self.evaluate(expr)
  File "D:\home\Zope-3.2.1\src\zope\tales\tales.py", line 696, in evaluate
    return expression(self)
   - d:\home\riccardo\projects\SrSite\lib\python\srlabs\browser\skin\template.pt
   - Line 22, Column 12
   - Expression: <PathExpr standard:u'context/@@view_get_menu/zmi_actions'>
   - Names:
      {'args': (),
       'container': <zope.app.folder.folder.Folder object at 0x03227DF0>,
       'context': <zope.app.folder.folder.Folder object at 0x03227DF0>,
       'default': <object object at 0x0099C548>,
       'loop': {},
       'nothing': None,
       'options': {},
       'repeat': {},
       'request': <zope.publisher.browser.BrowserRequest instance URL=http://metropolis/index.html>,
       'template': <zope.app.zptpage.zptpage.ZPTPage object at 0x038F9DF0>,
       'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object at 0x03AD1830>}
  File "D:\home\Zope-3.2.1\src\zope\tales\expressions.py", line 205, in __call__
    return self._eval(econtext)
  File "D:\home\Zope-3.2.1\src\zope\tales\expressions.py", line 192, in _eval
    ob = self._subexprs[-1](econtext)
  File "D:\home\Zope-3.2.1\src\zope\tales\expressions.py", line 124, in _eval
    ob = self._traverser(ob, element, econtext)
  File "D:\home\Zope-3.2.1\src\zope\app\pagetemplate\engine.py", line 72, in trustedZopeTraverser
    request=getattr(econtext, 'request', None))
  File "D:\home\Zope-3.2.1\src\zope\app\traversing\adapters.py", line 124, in traverse
    curr = traversePathElement(curr, name, path, request=request)
  File "D:\home\Zope-3.2.1\src\zope\app\traversing\adapters.py", line 179, in traversePathElement
    return traversable.traverse(nm, further_path)
   - __traceback_info__: (<zope.app.publisher.browser.viewmeta.MenuAccessView object at 0x039DEE10>, 'zmi_actions')
  File "D:\home\Zope-3.2.1\src\zope\app\traversing\adapters.py", line 58, in traverse
    return subject[name]
   - __traceback_info__: (<zope.app.publisher.browser.viewmeta.MenuAccessView object at 0x039DEE10>, 'zmi_actions', [])
  File "D:\home\Zope-3.2.1\src\zope\app\publisher\browser\menu.py", line 193, in __getitem__
    return getMenu(menuId, self.context, self.request)
  File "D:\home\Zope-3.2.1\src\zope\app\publisher\browser\menu.py", line 177, in getMenu
    return menu.getMenuItems(object, request)
  File "D:\home\Zope-3.2.1\src\zope\app\publisher\browser\menu.py", line 54, in getMenuItems
    if item.available():
  File "D:\home\Zope-3.2.1\src\zope\app\publisher\browser\menu.py", line 132, in available
    modules = sys.modules,
  File "D:\home\Zope-3.2.1\src\zope\tales\expressions.py", line 268, in __call__
    return int(not econtext.evaluateBoolean(self._c))
  File "D:\home\Zope-3.2.1\src\zope\tales\tales.py", line 701, in evaluateBoolean
    return not not self.evaluate(expr)
  File "D:\home\Zope-3.2.1\src\zope\tales\tales.py", line 696, in evaluate
    return expression(self)
   - Expression: <PathExpr standard:u'context/@@principalLastTransactionIsUndo'>
   - Names:
      {'context': <zope.app.folder.folder.Folder object at 0x03227DF0>,
       'default': <object object at 0x0099C548>,
       'loop': {},
       'nothing': None,
       'repeat': {},
       'request': <zope.publisher.browser.BrowserRequest instance URL=http://metropolis/index.html>}
  File "D:\home\Zope-3.2.1\src\zope\tales\expressions.py", line 205, in __call__
    return self._eval(econtext)
  File "D:\home\Zope-3.2.1\src\zope\tales\expressions.py", line 199, in _eval
    return ob()
  File "D:\home\Zope-3.2.1\src\zope\app\publisher\browser\viewmeta.py", line 435, in __call__
    return meth(*a, **k)
  File "D:\home\Zope-3.2.1\src\zope\app\undo\browser.py", line 34, in principalLastTransactionIsUndo
    last=1)
  File "D:\home\Zope-3.2.1\src\zope\app\undo\__init__.py", line 117, in getPrincipalTransactions
    return self._getUndoInfo(context, principal, first, last)
  File "D:\home\Zope-3.2.1\src\zope\app\undo\__init__.py", line 136, in _getUndoInfo
    specification.update({'user_name': path + ' ' + principal.id})
ForbiddenAttribute: ('id', Principal(u'ldap.tonon'))


More information about the Zope3-users mailing list