I was searching for the above functionality and found a solution using 
Flask and StringIO as below (short code snippet attached for convenience). 
Is there a way to do the same with web2py?



http://flask.pocoo.org/snippets/32/

#!/usr/bin/env python
# Thanks to Dan Jacob for a part of the code !
from flask import Flask, send_fileimport StringIO
app = Flask(__name__)
@app.route('/')def index():
    strIO = StringIO.StringIO()
    strIO.write('Hello from Dan Jacob and Stephane Wirtel !')
    strIO.seek(0)
    return send_file(strIO,
                     attachment_filename="testing.txt",
                     as_attachment=True)
        app.run(debug=True)

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to