ExporterCSV fails if virtual field included in fields=[... in SQLFORM.grid

21 views
Skip to first unread message

dgm...@gmail.com

unread,
Apr 24, 2019, 11:35:31 AM4/24/19
to web2py-users
my SQLFORM.grid includes a virtual field in fields[]. Displays perfectly in the grid, but CSV button using (ExporterCSV, ...) fails (I'm using web2py 2.18.5 Python 2.7):

Ticket ID

127.0.0.1.2019-04-24.11-28-41.edaaa1f3-2035-4402-bc95-4ff9a74097fb

<type 'exceptions.KeyError'> 'Name'

Version

web2py™ Version 2.18.5-stable+timestamp.2019.04.08.04.22.03

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
Traceback (most recent call last):
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\gluon\restricted.py", line 219, in restricted
exec(ccode, environment)
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\applications\init\controllers/default.py", line 1881, in <module>
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\gluon\globals.py", line 421, in <lambda>
self._caller = lambda f: f()
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\applications\init\models\db.py", line 110, in wrapped_f
return f(*args)
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\applications\init\controllers/default.py", line 130, in memberaffiliations
paginate=25, maxtextlength=150, user_signature = False, represent_none = '')
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\gluon\sqlhtml.py", line 2724, in grid
raise HTTP(200, oExp.export(), **response.headers)
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\gluon\sqlhtml.py", line 3776, in export
self.rows.export_to_csv_file(s, represent=True)
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\gluon\packages\dal\pydal\objects.py", line 2809, in export_to_csv_file
value = record[f]
File "C:\Users\David\Google Drive\My Documents\OxCamNE.3.0\gluon\packages\dal\pydal\objects.py", line 103, in __getitem__
raise KeyError(key)
KeyError: 'Name'

Reply all
Reply to author
Forward
0 new messages