[Zope] Loop throught empty list returned by python-script

Dieter Maurer dieter@handshake.de
Wed, 2 Jan 2002 21:47:04 +0100


Sven Hohage writes:
 > a DTML-Method should iterate through a list which a python-script called
 > "attributeDecider" is returning
 > <dtml-in "attributeDecider(attribute)">
 > <dtml-var id>
 > </dtml-in>
 > 
 > this is the python-script:
 > objects = context.objectValues('Folder')
 > liste = []
 > for object in objects:
 >         if hasattr(object,attribute) and object.attribute:
 >         liste.append(object)
 > return liste
 > 
 > -->attribute is  a boolean attribute and everything works fine except that
 > "attribute" is false -->
 > Zope is not rendering an empty page but it's trying to download the page
 > when I click on "view" in the ZMI
 > 
 > When I change <dtml-in "attributeDecider(attribute)"> to <dtml- var
 > "attributeDecider"> Zope shows an empty list-symbol (like expected).
 > Thanks for your patience for this end-of-year-problem and Happy New Year!!
I would bet that Zope renders the page correctly (it will return
a completely empty page) but your browser probably is unhappy with
the response.

Search the "HTTP 1.1" spec. There is a response code that says:
response empty. Use "RESPONSE.setStatus" to set the code.


Dieter