[Zope] Regarding Mysql Query
Dieter Maurer
dieter@handshake.de
Tue, 7 Aug 2001 23:09:35 +0200 (CEST)
sudhakar writes:
> ...
> <dtml-in test.py>
> <dtml-in DbQuery1 size=10 start=query_start>
> <dtml-let names="_.getitem('sequence-item')">
> ....
> but it's printing the object.
> <r instance at 02FF5E50>
Your code is a bit confused...
You have a nested "dtml-in": "sequence-item" refers to the innermost
"dtml-in", i.e. "DbQuery1".
Therefore, "_.getitem('sequence-item')" is one row of your
result, an "r instance", as you can see.
I would do it like this (avoidung the Python Script and the
second query execution):
<dtml-let result__=DbQuery1
names__="result__.names()">
<dtml-in result__ size=20 start=query_start>
<dtml-if sequence-start>
<table>
<tr><dtml-in names__><th>&dtml-sequence-item;</th></dtml-in></tr>
</dtml-if>
<tr><dtml-in names__><td><dtml-var "_['sequence-item']" html_quote></td></dtml-in</tr>
<dtml-if sequence-end>
</table>
</dtml-if>
</dtml-in>
</dtml-let>
Dieter