[Zope3-Users] zpt pages though ZMI

Hassan Alirezaei hassan at isi.imi.i.u-tokyo.ac.jp
Mon Sep 25 01:54:24 EDT 2006


Hi again Darryl,

just to check something real quick,

does Boston skin really check for authenticated principals??? I checked 
the main template and it looks like Boston is getting the 
request/principal/title in the same way as every other skin:


        <div id="userDetails" metal:define-slot="user_details">
          <metal:block define-macro="logged_user">
            <span tal:omit-tag="" i18n:translate="">User:</span>
            <tal:block replace="request/principal/title">User</tal:block>
          </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>

I could render the page with a ZCML principal but not a PAU principal. 
is it at all possible to do that? I think it is but I just don't can't 
the grip to it.

any gurus out there??? :)

regards,Hass


Hassan Alirezaei wrote:
> Thanks Darryl
>
> you were right about the title attribute of unauthenticated 
> principals. they don't have it.
> I made another ZCML principal with a title and it works fine.
>
> The problem still remains the same though for the principals in the 
> PAU. I always thought they do have a "title" bacause it is shown on 
> "ordinary pages" when you login. ( well unauthenticated principals 
> also show up :) )
>
> I checked it with Boston skin. The principal title gets rendered but 
> there is again another problem with some "econtext.view" that messes 
> everything up again. I will try to figure that out or just borrow the 
> request/principal/title part from boston skin and hang with my own 
> skin which I like better.
>
> Thanks again
>
>
>
> Darryl Cousins wrote:
>> Hi,
>>
>> Your problem is
>> in /home/hassan/HOMEPAGE2/modules/ISI/skin/template_tablelayout.pt and
>> UnauthenticatedPrincipal does not have attribute 'title'.
>>
>> Check Boston skin template which first tests for authenticated user
>> before calling request/principal/title.
>>
>> Regards,
>> Darryl
>>
>> On Sun, 2006-09-24 at 19:43 +0900, Hassan Alirezaei wrote:
>>  
>>> Hello everyone,
>>>
>>> Does anyone know the easiest way to let people (principals of a 
>>> site) develop their own pages with no knowledge about zop3 
>>> structure? AFAIK The users need to make their own pages with HTML 
>>> (more generally ZPT) and upload them as a ZPT page.
>>>
>>> I dont want my whole website skin to disappear so I use the 
>>> context/@@standard_macros/page for the zpt page.
>>>
>>> when I add it, the page renders fine for the Manager(ZCML) but not 
>>> for other principals, apparently the title for each principal can 
>>> not be traversed.
>>>
>>> this is my zpt page which I upload through the ZMI as Manager:
>>>
>>>
>>> ---------------------------------------------------------------------------------------------------------------------------- 
>>>
>>> <html metal:use-macro="context/@@standard_macros/page">
>>>
>>> </html>
>>> ---------------------------------------------------------------------------------------------------------------------------- 
>>>
>>>
>>>
>>> and here is the error:
>>> --------------------------------------------------------------------------------------------------------------------------- 
>>>
>>>   File "/usr/local/Zope-3.3.0c1/lib/python/zope/tales/tales.py", 
>>> line 696, in evaluate
>>>     return expression(self)
>>>    - /home/hassan/HOMEPAGE2/modules/ISI/skin/template_tablelayout.pt
>>>    - Line 59, Column 36
>>>    - Expression: <PathExpr standard:u'request/principal/title'>
>>>    - Names:
>>>       {'args': (),
>>>        'container': <zope.app.folder.folder.Folder object at 
>>> 0xb50880ac>,
>>>        'context': <zope.app.folder.folder.Folder object at 0xb50880ac>,
>>>        'default': <object object at 0xb7d44550>,
>>>        'loop': {},
>>>        'nothing': None,
>>>        'options': {},
>>>        'repeat': {},
>>>        'request': <zope.publisher.browser.BrowserRequest instance 
>>> URL=http://124.102.91.194:8080/ZPTPage>,
>>>        'template': <zope.app.zptpage.zptpage.ZPTPage object at 
>>> 0xb50885ec>,
>>>        'usage': <zope.pagetemplate.pagetemplate.TemplateUsage object 
>>> at 0xb503654c>}
>>>   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__: 
>>> (<zope.app.security.principalregistry.UnauthenticatedPrincipal 
>>> object at 0xb7390b6c>, 'title')
>>>   File 
>>> "/usr/local/Zope-3.3.0c1/lib/python/zope/traversing/adapters.py", 
>>> line 52, in traverse
>>>     raise TraversalError(subject, name)
>>>    - __traceback_info__: 
>>> (<zope.app.security.principalregistry.UnauthenticatedPrincipal 
>>> object at 0xb7390b6c>, 'title', [])
>>> TraversalError: 
>>> (<zope.app.security.principalregistry.UnauthenticatedPrincipal 
>>> object at 0xb7390b6c>, 'title')
>>>
>>> --------------------------------------------------------------------------------------------------------------------------------------- 
>>>
>>>
>>>
>>>
>>>
>>> Not is this the expected behavior or am I doing something wrong???
>>>
>>> thanks for any help.
>>> Hass
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> Zope3-users mailing list
>>> Zope3-users at zope.org
>>> http://mail.zope.org/mailman/listinfo/zope3-users
>>>     
>>
>>
>>
>>   
>
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users
>
>



More information about the Zope3-users mailing list