In a DTML method I'd like to pass the result from an ZSQL method to aPython script. I've tried the following (which doesn't work but explainsmy idea): Having a ZSQL my_zsql_members_call simply defined as: SELECT * FROM members; I'd hoped that in: <dtml-let members=my_zsql_members_call> <dtml-in my_zsql_iterator_call prefix="seq"> <dtml-var my_python_call(item=seq_item,members=members)> </dtml-in> </dtml-let> the my_zsql_members_call would return a *list* of multiple rows (or kind ofsequence object) of members information data to be used thereafter in the <dtml-in> iteration. Obviously, this is not the case. Technically, my problem can simply be restated as follows: how do I retrieve a multiple row ZSQL result and bind it to a single variable so that it can be passed to and iterated upon in a Python script? Thanks. -- _____________________________________________________________________ Versatel ADSL Gratis. De voordelen van gratis internet met de snelheid van ADSL. Zonder abonnementskosten en zonder vast contract. Je betaalt alleen voor de tijd online. Nu zonder aansluitkosten en met gratis modem. Bestel snel op www.versatel.nl.
burley@zonnet.nl wrote at 2005-3-9 13:26 +0100:
... I'd hoped that in: <dtml-let members=my_zsql_members_call>
<dtml-in my_zsql_iterator_call prefix="seq"> <dtml-var my_python_call(item=seq_item,members=members)> </dtml-in>
</dtml-let>
the my_zsql_members_call would return a *list* of multiple rows (or kind ofsequence object) of members information data to be used thereafter in the <dtml-in> iteration. Obviously, this is not the case.
It should indeed. However, the code above calls your Z SQL Method twice (a waste of time!). Use "<dtml-in members ...>" instead (this has nothing to do with your problem, it is just a sidenote).
Technically, my problem can simply be restated as follows: how do I retrieve a multiple row ZSQL result and bind it to a single variable so that it can be passed to and iterated upon in a Python script?
The code above should do this. What (precise!) kind of problem you observe (error type, error value and traceback!) -- Dieter
On Wed, 2005-03-09 at 19:28, Dieter Maurer wrote:
burley@zonnet.nl wrote at 2005-3-9 13:26 +0100:
... I'd hoped that in: <dtml-let members=my_zsql_members_call>
<dtml-in my_zsql_iterator_call prefix="seq"> <dtml-var my_python_call(item=seq_item,members=members)> </dtml-in>
</dtml-let>
the my_zsql_members_call would return a *list* of multiple rows (or kind ofsequence object) of members information data to be used thereafter in the <dtml-in> iteration. Obviously, this is not the case.
It should indeed.
However, the code above calls your Z SQL Method twice (a waste of time!).
Note that the two calls are different (a ZSQL call en Python call, respectively).
Use "<dtml-in members ...>" instead (this has nothing to do with your problem, it is just a sidenote).
This would iterate over the members, which I don't want. The entire members list should be made available to the my_python_call function.
Technically, my problem can simply be restated as follows: how do I retrieve a multiple row ZSQL result and bind it to a single variable so that it can be passed to and iterated upon in a Python script?
The code above should do this.
What (precise!) kind of problem you observe (error type, error value and traceback!)
I don't get any error at all! In the python script the members parameter is just equal to its default argument "" (i.e. an empty string). Conclusion: although it's all legal DTML code, the <dtml-let> statement, however, doesn't do anything.
Henk Jansen wrote at 2005-3-9 21:40 +0100:
I'd hoped that in: <dtml-let members=my_zsql_members_call>
<dtml-in my_zsql_iterator_call prefix="seq"> <dtml-var my_python_call(item=seq_item,members=members)>
Here is a bug! "..." are missing around "my_python_call(...)"!
</dtml-in>
</dtml-let> ... I don't get any error at all! In the python script the members parameter is just equal to its default argument "" (i.e. an empty string).
This is (almost) impossible unless the objects returned by "my_zsql_interator_call" provide access to a different "members" (and with "" as value). Try: <dtml-let some_name_surely_not_used_elsewhere=my_zsql_members_call> <dtml-var "my_python...(... members=some_name_surely_not_used_elsewhere)"> In case the "..." are really missing in your code (and not only in your message), then the code is not executed at all and you wrong parameter value must come from elsewhere. -- Dieter
participants (3)
-
burley@zonnet.nl -
Dieter Maurer -
Henk Jansen