Edward Huixquic wrote at 2005-6-5 19:21 -0500:
>> ><dtml-if process >
>> > <dtml-in fields mapping>
>> > <dtml-call "pyUpdate(REQUEST)">
>> Why do you call "pyUpdate" in a loop?
>Well, actually I am getting the "fields" data from a ZSQLMethod
>dictionaries(), so, I am trying to do something to each record (in the
>list itself and later on I "post" changes into the database, hence the
>python loop, as shown in the pyUpdate external method i used in my
But the call only references "REQUEST". Thus, unless your
fields contain a key "REQUEST", the call is independent from
the loop variable -- you will get the same result for each round
in the loop...
>As you may have guessed so far, I am a newbie, trying to figure out
>this great Zope technology.
An "ExternalMethod" is almost a Python function -- with almost
no magic (apart from auto passing of "self" under special conditions).
Especially, an "ExternalMethod" does not know the DTML namespace
(unless you pass it explicitly). You must pass arguments directly
if you want current values of DTML variables be available in the
"ExternalMethod". This is unlike the magic passing of
the DMTL namespace to other DMTL objects (under special conditions).
>Powerful but hard to learn, as you
>probably heard before, I am trying to grab that Zope spark...fighting
>against namespaces, acquisition, and other abstract Zope concepts.
Maybe, you read
>In my example, if "fields" actually come from a
>Zsqlmethod.dictionaries() object, what would be the best way to pass
>thru all and every single one of the records in the list ?
The most natural way, you can imagine: you simple call
your "ExternalMethod" with this dictionary list as parameter.
Note that DTML performs some magic for its "name" attributes.
If its value is callable, it automatically calls it.
Inside an "expr" attribute, there is no such magic.
This means, that you sometimes need to call explicitly (probably
not in your example but sometimes...).
Zope maillist - Zope@zope.org
** No cross posts or HTML encoding! **
(Related lists -