[Zope3-Users] zpt pages though ZMI
Hassan Alirezaei
hassan at isi.imi.i.u-tokyo.ac.jp
Mon Sep 25 07:49:00 EDT 2006
Hassan Alirezaei wrote:
>
>> In my own skin I'm using
>> <span tal:replace="request/principal/title">User</span>
>>
>> with no problem for either zcml principals nor pau principals.
>>
> Thanks Darryl, I got it working. <span> did the trick!
>
>
I thought It did work Darryl But I had a small mistake in the template
so the whole request/principal/title was not even parsed. Now that I fix
it again with:
<span tal:replace="request/principal/title">User</span>
it still doesn't work. when I print the Principal object itself
(request/principal) i get
<security proxied zope.app.security.principalregistry.Principal instance
at 0xb669fccc>
for the zope.manager and
<security proxied zope.app.authentication.principalfolder.Principal
instance at 0xb596d22c>
for the PAU manager which is different as expectedly different of course.
*****************************************************************************************************************
once again to the original problem, when I upload the following ZPT
page through the ZMI,
----------------------
<html metal:use-macro="context/@@standard_macros/page"> </html>
--------------------
I get the following error when viewing it while logged in with a PAU
principal:
--------------------
File "/usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py",
line 217, in __call__
return self._eval(econtext)
File "/usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py",
line 194, in _eval
ob = self._subexprs[-1](econtext)
File "/usr/local/Zope-3.3.0c1/lib/python/zope/tales/expressions.py",
line 124, in _eval
ob = self._traverser(ob, element, econtext)
File
"/usr/local/Zope-3.3.0c1/lib/python/zope/app/pagetemplate/engine.py",
line 68, in __call__
request=request)
File "/usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py",
line 164, in traversePathElement
return traversable.traverse(nm, further_path)
- __traceback_info__: (Principal(u'isi.mas.hassy'), 'title')
File "/usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py",
line 52, in traverse
raise TraversalError(subject, name)
- __traceback_info__: (Principal(u'isi.mas.hassy'), 'title', [])
TraversalError: (Principal(u'isi.mas.hassy'), 'title')
-------------------
here is how I refer to the request/principal/title :
---------------------------------------
<div id="userDetails" metal:define-slot="user_details">
<metal:block define-macro="logged_user">
<span tal:omit-tag="" i18n:translate="">User:</span>
<span replace="request/principal/title">User</span>
</metal:block>
<metal:block define-slot="login_logout">
<metal:macro define-macro="login_logout">
<tal:block content="structure context/@@login_logout" />
</metal:macro>
</metal:block>
</div>
-------------------------------------
using <span replace="request/principal/title">User</span>
will work quite fine on every normal page I have and I can get the title
for all the principals (ZCML and PAU)
but when I upload the ZPT and look at it, ONLY ZCML users render without
any problem. unauthenticated user in the ZCML also can not render.
Thank you again for any help.
Regards,
Hassan
More information about the Zope3-users
mailing list