Apache Mod-Python - Re: Created: (MODPYTHON-97) mod_python.publisher iterablesand content_type broken

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > December 2005 > Re: Created: (MODPYTHON-97) mod_python.publisher iterablesand content_type broken





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: Created: (MODPYTHON-97) mod_python.publisher iterablesand content_type broken
Graham Dumpleton

2005-12-09, 2:47 am

Grisha wrote ..
>
> On Thu, 8 Dec 2005, Gregory (Grisha) Trubetskoy wrote:
>
>
> Actually, I take that back. It should return something more along the
> lines of '<generator object at 0x81ba5ec>'.
>
> Does this make sense?


Which is what it used to do before the change was introduced.

As the generator object has an __iter__ method it is being iterated over
and the result from each item concatenated.

See code:

def publish_object(req, object):
if callable(object):

# To publish callables, we call them an recursively publish the result
# of the call (as done by util.apply_fs_data)

req.form = util.FieldStorage(req, keep_blank_values=1)
return publish_object(req,util.apply_fs_data(object, req.form, req=req))

elif hasattr(object,'__iter__'):

# To publish iterables, we recursively publish each item
# This way, generators can be published
result = False
for item in object:
result |= publish_object(req,item)
return result

else:
....

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com