open(filename,'wb').save(response.render(view_filename,dict(a=3)))
On Apr 2, 5:22 pm, JC11 <[email protected]> wrote:
> Sorry I did not make that clear. The file should be saved on the
> server.
> JC
>
> On Apr 2, 2:16 pm, mdipierro <[email protected]> wrote:
>
> > Yes but I am not sure from your question if you want the visitor to
> > save the file on the client machine or on the server machine. I assume
> > the former:
>
> > def save_file():
> > filename='bla.html'
> > response.headers['Content-Disposition']='attachment;
> > filename="%s"' % filename
> > return dict(var='whatever')
>
> > On Apr 2, 2:07 am, JC11 <[email protected]> wrote:
>
> > > Hello,
> > > I would like to use the excellent template facilities in web2py views
> > > {{....}} but save the results to a file rather than present them as a
> > > web page. How would this be possible ?
>
> > > This is just for one of several views in my application and should
> > > happen always for the one view without the user needing to do
> > > anything. This can manually be achieved by the user seeing the page,
>
> > > > view source, > save as .....
>
> > > Thanks,
> > > JC
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---