Yes it was the older version. 
Thanks for your suggestions guys, I used a combination of response.js and 
frame to render the response and also open a save as dialog.. In short:

in 
form_query():
    response.js = "jQuery('#ddl').attr('src','form_query_download')"

And 
form_query_download():
    code to re run the query or read from session after storing rows using 
rows.as_list() and stream results as a csv file:

#ddl refers to the id of an empty iframe thats invisible.

mave


On Wednesday, September 12, 2012 4:41:21 AM UTC-7, Anthony wrote:
>
> 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
>>>
>>

-- 



Reply via email to