Oh right, the point was the point ...
now it works fine with:
open('test.csv', 'wb').write(str(db(db.person.id).select()))
thanks a lot
Am Freitag, 7. August 2015 20:39:32 UTC+2 schrieb [email protected]:
>
> He group,
>
> i create serial letters with web2py and pdfLatex. It works fine with a
> static csv-file in private folder.
> But i want to create the csv and save directly to the folder. No Download!
>
> I create the csv ... no Problem:
>
> @auth.requires_login()
> def create_csv():
> from gluon.contenttype import contenttype
> import os
> response.headers['Content-Type'] = contenttype('.csv')
> response.headers['Content-disposition'] = 'attachment;
> filename=%s_database.csv' % (
> request.now
> )
> import csv, cStringIO
> s = cStringIO.StringIO()
> db((db.grunddaten.id>0)).select().export_to_csv_file(s,
> delimiter=',', quotechar='"', quoting=csv.QUOTE_NONNUMERIC)
> return s.getvalue()
>
> But how can i save this file directly on my folder?
>
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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 [email protected].
For more options, visit https://groups.google.com/d/optout.