[Product-Developers] Traversing to an object like the publisher does

Hedley Roos hedley at upfrontsystems.co.za
Thu May 14 12:14:54 UTC 2009


Jan Hackel wrote:
> I need to write a test that essentially needs to traverse to an operation like 
> the following tal-expression would:
> 
> tal:condition="context/@@plone_context_state/is_view_template"
> 
> It seems I cannot use "(un)restrictedTraverse" because it does not trigger my 
> custom IPublishTraverse adapter. Using "Request.traverse" looks promising but 
> I cannot get authorization to work with it, i.e. I get an 
> UnauthorizedException.
> 
> Is there a canonical way of simulating the tal-expression given above?
> 
> Grüße
> Jan Hackel
> 

context.restrictedTraverse('@@plone_context_state').is_view_template()

Hedley






More information about the Product-Developers mailing list