[Zope] Modifying a Dictionaries in an Extenal Method

Dieter Maurer dieter at handshake.de
Tue Jun 7 13:17:54 EDT 2005


Edward Huixquic wrote at 2005-6-7 01:11 -0500:
>Since you sent your reply not to the list but to my email

That was a mistake. It should have gone to the mailing list...

> I dared to
>respond directly, let me know if you prefer not to receive direct
>emails and sorry if my dare bothered you.

In principle, all Zope related messages should go to a mailing
list and not to me privately...

> ...
>That is why I am passing the "REQUEST" to the External Method, as "to
>make it aware  of the DTML variables (environment)

"REQUEST" does *not* know about DTML variables.

>, actually the ones
>that are created from the MySQLMethod.dictionaries()   So, in the
>future I will call directly like:
>
><dtml-call "MyExternalMethod(MyZSQLMethod.dictionaries())"> 

I am not familiar with "dictionaries" (it is in fact less
efficient than the use of the result directly).

But, I expect that "dictionaries" is not a method of
the "Z SQLMethod" itself but instead of its result.

If I am right, then you must use "MyZSQLMethod().dictionaries()".

> ...
>> >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
>> 
>>   <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
>
>Thanks for the suggestion.  Already  reading it.
>
>>......
>> The most natural way, you can imagine: you simple call
>> your "ExternalMethod" with this dictionary list as parameter.
>> 
>>      <dtml-{var|call} expr="myExternalMethod(fields)">
>> 
>> 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...).
>
>In your example, I understand  "fields" must be preassigned to  say,
>MyZSQLMethod.dictionaries()

I used the "fields" from your example.

Whatever it is, you can pass it to an "External Method" (or
other function like object). You may need to call it explicitly
to get the same effect as you would get when you used it as
a DTML variable, as I explained above.

-- 
Dieter


More information about the Zope mailing list