Hello,

I have to generate KML (XML) files on the fly for Google earth. As the
file can be quite big (~10 MB), I'd like to return a generator instead
of a "big" string. I use Genshi (0.4.4) as template engine which is able
to return a <generator object>.

Here is my code :

(...)

# Query
c.results = select(
    cols,
    and_(*where_clauses),
    from_obj = [from_clauses],
    order_by = 'taxonomy'
).execute()

# Load and generate template
from genshi.template import TemplateLoader
loader = TemplateLoader([TEMPLATES_PATH])
tmpl = loader.load('map/partials/bytaxa.html')
stream = tmpl.generate(c=c, h=h)

# Render response (through a generator object)
response = Response()
response.content = stream.serialize()
#response.content = render('map.partials.bytaxa', method='xml')
response.headers['Content-Type'] = 'application/vnd.google-earth.kml
+xml'
response.headers['Content-disposition'] = 'attachment;
filename=data.kml'

return response

It works when debug is set to true in my configuration file (altough the
generator is "not used" because of the ErrorMiddleware).

When I set debug to false, it fails with the following error : 
Error - exceptions.TypeError: No object (name: C) has been registered
for this thread

I guess it has something to do with a missing StackedObjectProxy ... but
I can't find where could be the problem

Any idea ?

Thanks,
Julien


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to