Are you using the latest version of web2py? That's a new option. On Wednesday, September 12, 2012 4:43:50 AM UTC-4, maverick wrote: > > Anthony, > Thanks for the explanation. > > I tried cacheable=True in my select(), like: > rows = db().select(db.vmt_weekly.ALL, cacheable=True) > > but it is met with internal error: <type 'exceptions.SyntaxError'> > invalid select attribute: cacheable > > Is there something I'm missing? > > mave > > > On Tuesday, September 11, 2012 10:17:48 PM UTC-7, Anthony wrote: >> >> Can you show me how I could modify form_query() to embed JS (if I've >>> understood your second option correctly) in order to trigger the download? >>> >> >> You're not going to be able to have a single call to form_query both >> return HTML content and stream a file at the same time -- those are two >> separate HTTP responses, so you need two separate requests. Return the HTML >> first, and then request the file separately. If you don't want to repeat >> the query to re-generate the rows object again, in your select(), add >> cacheable=True. That will allow you to store rows in the session when >> form_query is called. Your subsequent call to fetch the file can then >> retrieve rows from the session, convert to csv, and then stream. >> >> Anthony >> >
--