John Poltorak wrote:
On Fri, Jun 17, 2005 at 07:09:04PM +0200, Dieter Maurer wrote:
Tino Wildenhain wrote at 2005-6-17 10:57 +0200:
... Not at all. You could either have tried it out ;) Or looked at the DTML documentation in the Zope book *wink* ;)
<dtml-var expr="somemethod(parm1=value1,parm2=value2)">
Be warned: this is likely to cause loss of the namespace. Do not forget to pass the two positional arguments (usually as "None, _"). They are essential.
For more details, read "Calling DTML Objects" of
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
That looks useful.
Is there also something which explains how to call ZPTs from a DTML object?
I'm unable to pick up a passed parameter.
This is what I've conjured up:-
python:here.lib.parse_file(file=context.options['parm'],sepr=',',clone=1)">
hoping that "options['parm']" would get resolved as "ABC" but it doesn't.
Any ideas?
When you call a ZPT like:: context.somePT(dog="beagle") you can get to it in the template like:: options/dog or:: python:options.dog or:: python:getattr(options,'dog') or maybe even:: python:options['dog'] Note that in the last two, I didn't need to know the name of the parameter at coding time, but could find it at runtime. If I have:: tal:define="att string:dog" then I can do:: python:getattr(options,att) The 'options' name is not contained in context. It is it's own first-class namespace. If 'parse_file' above is a ZPT, you can ask for options/file, options/sepr, and options/clone. --jcc -- "Building Websites with Plone" http://plonebook.packtpub.com/ Enfold Systems, LLC http://www.enfoldsystems.com