[Zope] Acquisition question

Ferhat Ayaz ferhatayaz at yahoo.com
Tue Aug 29 16:42:43 EDT 2006


wow. Thanks. This is exactly that what I need. :)

--- Dieter Maurer <dieter at handshake.de> wrote:

> Ferhat Ayaz wrote at 2006-8-28 11:06 -0700:
> >Here my question:
> >
> >You can do acquisition on URL like
> >
>
>http://localhost:8080/employee_by_id/emp_id/2/viewEmployee
> >
> >here the result of employee_by_id (param is
> emp_id=2)
> >is used by viewEmployee.
> >
> >But I want to use it in a page template like
> >
> ><td tal:content=
> >   "structure mployee_by_id/emp_id/2/viewEmployee">
> ></td>
> >
> >Unfortunatly this will not work like the above
> >example.
> 
> The reason for this different behaviour is that a
> ZSQL method uses a traversal hook to implement the
> "<method>/<parameter>" feature.
> This traversal hook is only activated during URL
> traversal
> but not for path expression evaluation.
> 
> Fortunately, you do not need this hook in TALES.
> You can instead use a Python expression to call
> the ZSQL Method explicitely:
> 
>     <td tal:content="
>       structure
> python:employee_by_id(emp_id=2).viewEmployee()
>       " />
> 
> This will work only (reliably) when "viewEmployee"
> is
> a PageTemplate (not a DTML object).
> 
> For a DTML object "viewEmployee" you could use:
> 
>    <td tal:define="employee
> python:employee_by_id(emp_id=2)"
>      tal:content="employee/viewEmployee"
>      />
> 
> You find the reason for this strange DTML object
> behaviour
> in the "Calling DTML objects" section of
> 
>  
>
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
> 
> 
> 
> -- 
> Dieter
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Zope mailing list