Andreas Jung schrieb:

--On 3. Juli 2006 15:50:41 +0200 Tonico Strasser <[EMAIL PROTECTED]> wrote:

Claudio Battaglino schrieb:
what does exactly happen when I use "python:" into a zpt?
Is it a problem if I have many "python:" in my page templates?

Path expressions are by far better human readable IMHO. I try very hard
to avoid Python expressions if possible.

(Un)fortunately we live a in world where methods may have parameters. Path expressions work only for parameter-less methods.

This can be avoided if you "prepare" a namespace and pass it to the template, this way the template doesn't need to call methods.

I've written a simple page class for doing this, but it's also possible TTW from a Python script:

  names = {'foo': 'bar'}
  template = context.a_page_template
  return template.pt_render(extra_context=names)

Of course you can still use Python expressions if needed.


Zope maillist  -
**   No cross posts or HTML encoding!  **
(Related lists - )

Reply via email to