On Monday, November 14, 2016 at 12:04:53 PM UTC-8, Dave S wrote:
>
> [...] 
>
If it's any help, the appadmin.py for returning a CSV is
>
> def csv():
>     import gluon.contenttype
>     response.headers['Content-Type'] = \
>         gluon.contenttype.contenttype('.csv')
>     db = get_database(request)
>     query = get_query(request)
>     if not query:
>         return None
>     response.headers['Content-disposition'] = 'attachment; 
> filename=%s_%s.csv'\
>         % tuple(request.vars.query.split('.')[:2])
>     return str(db(query, ignore_common_filters=True).select())
>
>
>
>
>  In this case, query is from the form where you say something like "(
> db.tablenm.id > 400) & (db.tablenm.fault.contains('user'))"
>
>
BTW, for my example query, appadmin really does use the filename 
"(db_tablenm.csv" ... unpairing the paren  ;-)

/dps
 

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to