Thanks Rik it works. I've noticed in some cases that one puts empty brackets at the end of certain zope object methods. Is that there for methods that can take parameters? [rh]Um, not quite, it has to do with the way of calling the object methods in question. DTML has two ways of calling: by name and through expressions. 1. The 'normal' Zope way of writing things is <dtml-var objectValues>. This is shorthand for <dtml-var name="objectValues">. 2. The other way is <dtml-var "objectValues">. This is shorthand for <dtml-var expr="objectValues">. Everything inside the expression is treated as a python expression. If you call it without the brackets, you're just referencing the method. If you try that in a DTML Method and look in the source of the diplayed document you'll see something like <Python Method object at 13fcbf0>. If you want to _call_ the method, you'll have to add the brackets (with or without arguments). Hope this is clear. Rik
Very clear, thanks. Really appreciated. Well i guess the topic was never about propertyids, but i can only tell that now. Still working with properties i find the following trouble. <dtml-var "MyDoc.propertyItems()"> returns a list of key-value pairs [('Key1','Value1'},('Key2','Value2')] to access the values of each key sequentially i tried: <dtml-in "MyDoc.propertyItems()"> <dtml-let s="_['sequence-item']" key=s[:1] value=[1:]> <dtml-var key>:<dtml-var value><br> </dtml-in> But this just returns "k" and "ey" resulting in a slice of the keyname. Roché
Thanks Rik it works.
I've noticed in some cases that one puts empty brackets at the end of certain zope object methods. Is that there for methods that can take parameters?
[rh]Um, not quite, it has to do with the way of calling the object methods in question. DTML has two ways of calling: by name and through expressions.
1. The 'normal' Zope way of writing things is <dtml-var objectValues>. This is shorthand for <dtml-var name="objectValues">.
2. The other way is <dtml-var "objectValues">. This is shorthand for <dtml-var expr="objectValues">. Everything inside the expression is treated as a python expression. If you call it without the brackets, you're just referencing the method. If you try that in a DTML Method and look in the source of the diplayed document you'll see something like <Python Method object at 13fcbf0>. If you want to _call_ the method, you'll have to add the brackets (with or without arguments).
Hope this is clear.
Rik
On Mon, 19 Jun 2000, RC Compaan wrote:
<dtml-var "MyDoc.propertyItems()"> returns a list of key-value pairs [('Key1','Value1'},('Key2','Value2')]
to access the values of each key sequentially i tried: <dtml-in "MyDoc.propertyItems()">
When running over a list of pairs, dmtl-in automatically splits pairs into sequence-key and sequence-item Oleg. (All opinions are mine and not of my employer) ---- Oleg Broytmann Foundation for Effective Policies phd@phd.russ.ru Programmers don't die, they just GOSUB without RETURN.
participants (3)
-
Oleg Broytmann -
RC Compaan -
Rik Hoekstra