[Zope] Returning a list of dictionaries from an external method yields "Loop over non-sequence" when tested
Charlie Reiman
creiman@kefta.com
Mon, 8 Jul 2002 16:22:15 -0700
First, please post in plain text, not HTML. It saves space and keeps the
natives from getting restless.
As a general rule, try breaking problems down to smaller bits. You've posted
a Really Big Thing for anyone else to spend time deciphering.
I suspect what you are trying to do could be achived with something like:
<dtml-in all_players prefix=player>
<dtml-in expr="kill_stats(player_item)" prefix=kill>
<dtml-var kill_item>
or maybe
<dtml-var kill_item.sucking_wounds>
<dtml-var kill_item.gaping_wounds>
</dtml-in>
<dtml-in expr="hostage_kill_stats(player_item)" prefix=hostage>
<dtml-var hostage_item>
</dtml-in>
...etc...
</dtml-in>
In other words, don't do everything at once. This will greatly reduce the
severity and frequency of your headaches.
FWIW, you might need to use the dtml-in mapping option if you insist on
using python code and returing sequences of dictionaries. You could also,
possibly, use pluggable brains.
The following included message is greatly shortened...
-----Original Message-----
From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Thomas
Weholt
Sent: Monday, July 08, 2002 4:04 PM
To: zope@zope.org
Subject: [Zope] Returning a list of dictionaries from an external method
yields "Loop over non-sequence" when tested
I've got a simple external method that returns a list containing
dictionaries. If I run it from python it works fine, imported and used in
Zope it raises an exception "Loop over non-sequence".
The script extracts some data from a table, containing the results from a
parsed logfile, created by the game Counter-strike ( if you're interested ).
I'm no expert in SQL ( as the code below probably shows )
but doing it in Python is no match ( even if the code is verbose and perhaps
a bit inefficient. Tips and clues are appreciated if you can make anything
out of it ).
......