Hello, Thank you for the response. I may end up using Excel files instead, so that part is just a placeholder. My main concern is finding an efficient way to generate and serve the files. It would take too much memory to load the whole file into memory and then send it, and I'm trying to avoid writing the file to disk and then streaming it.
It seems like using generators lets you get around that, but I haven't used them on a production server in that manner. I want to see if it's a reliable solution or if there is something better for Pylons apps. Thanks! Eric On Mon, Sep 20, 2010 at 5:42 AM, Mengu <[email protected]> wrote: > i recommend you using the built-in csv method: > > http://docs.python.org/library/csv.html > > On Sep 20, 10:40 am, Eric Rasmussen <[email protected]> wrote: > > Hello, > > > > I'm building a Pylons app that will let authorized users export > membership > > data to csv. Based on some research I have a working model (below), but > I'm > > new to serving this type of content and am wondering if there is a > > Pylons-preferred method. > > > > One function uses POST data to build a query and then passes it here > (this > > is a simplified excerpt): > > > > def export_stream(self, query): > > response.content_type = 'text/csv' > > for member in query: > > yield '%s,%s\n' % (member.id, > > member.joindate.strftime('%m/%d/%Y')) > > > > Thanks! > > Eric > > -- > 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]<pylons-discuss%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/pylons-discuss?hl=en. > > -- 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.
