SQLForm.grid csv export

41 views
Skip to first unread message

Ryan Hood

unread,
Jul 28, 2016, 4:17:50 AM7/28/16
to web2py-users

Hello,

 

I'm pretty new to Web2py.  I need some help with the SQLForm.grid export CSV functionality.    I have the following basic structure:

 

db.py

db.define_table('test',

                Field('name', 'string', length=50, notnull=True),

                Field('email', 'string', notnull=True),

                format="%(name)s")

default.py

def index():

    query=(db.test.id>0)

    fields=[db.test.id,db.test.name,db.test.email]

    forms=SQLFORM.grid(query=query, csv=True)

    return dict(forms=forms)

 

For some reason only the JSON and XML exports work but the CSV and TSV exports won't work.  For CSV, I keep getting the following error:

 

<type 'exceptions.AttributeError'>

 

NOTE: my argument list looks like this: 

Function argument list

(self=<Row {'email': 't', 'name': 'ryan', 'id': 1L}>, k='_extra')

 

NOTE: I have tried a couple different versions of Web2py on both CentOS and Windows and same error.

 

I'm sure I'm missing something small, but haven't been able to track it down.  Any help would be appreciated.

 

Thank you,

ryan

Remco Boerma

unread,
Sep 1, 2016, 3:47:37 PM9/1/16
to web...@googlegroups.com
Although it's been half a year; for the record, see this post: https://groups.google.com/d/msg/web2py/6W-jf3EPb04/x3hSC5ySCgAJ 

Reply all
Reply to author
Forward
0 new messages