Simple example:-
I have an index() controller thats sets some variables.
I have a view default/index.html that displays the variables.
I have another view default/index.csv that renders the variables (e.g. as
a,b,c) and this downloads ok as a file (with filename index.csv) if I
visit the url ....../default/index.csv
I added a form to index.html, with a submit button called 'download', in
the index controller, if the user has clicked the 'download' button, I am
trying to use response.view or response.render to do the equivalent of
manually visiting the url that ended in '.csv'
Various failed attempts so far, I either get a view on the screen with
'None', or view not found, or currently:-
if request.vars.btn == 'download':
response.view = 'default/index.csv'
return locals()
else:
return locals()
the above causes the index.csv to be displayed in the browser with
html,header and body tags (which are not in the view), how do I get this
'view' to be downloaded as a file named 'index.csv' !?