I implemented a clone of Notifier application from Massimo.
If I try to export data from the grid via the grid bottom button I receive
an error if I use export to CSV, HTML & TSV but not with JSON or XML.
*default.py*
@auth.requires_login()
def tasks():
db.task.created_on.readable = True
db.task.created_by.readable = True
db.task.title.represent = lambda title, row:A(title, _href=URL(
'view_task', args=row.id))
query = (db.task.assigned_to==me)|(db.task.created_by==me)
grid = SQLFORM.grid(query,
orderby=~db.task.modified_on,
create=False,
details=False,
editable=False,
deletable=lambda row: (row.created_by==me),
fields=[
db.task.status,
db.task.title,
db.task.created_on,
db.task.deadline,
db.task.created_by,
db.task.assigned_to
])
return locals()
*Traceback*
Traceback (most recent call last):
File "/home/sysadmin/Téléchargements/web2py/gluon/restricted.py", line 227,
in restricted
exec ccode in environment
File
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/tasklist/controllers/default.py>,
line 134, in <module>
File "/home/sysadmin/Téléchargements/web2py/gluon/globals.py", line 412, in
<lambda>
self._caller = lambda f: f()
File "/home/sysadmin/Téléchargements/web2py/gluon/tools.py", line 4236, in
f
return action(*a, **b)
File
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/tasklist/controllers/default.py>,
line 31, in tasks
db.task.assigned_to
File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 2440,
in grid
raise HTTP(200, oExp.export(), **response.headers)
File "/home/sysadmin/Téléchargements/web2py/gluon/sqlhtml.py", line 3468,
in export
self.rows.export_to_csv_file(s, represent=True)
File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py",
line 2412, in export_to_csv_file
value = field.represent(value, record)
File
"/home/sysadmin/Téléchargements/web2py/applications/tasklist/controllers/default.py"
<http://127.0.0.1:8000/admin/default/edit/tasklist/controllers/default.py>,
line 17, in <lambda>
db.task.title.represent = lambda title, row:A(title, _href=URL('view_task',
args=row.id))
File "/home/sysadmin/.local/lib/python2.7/site-packages/pydal/objects.py",
line 90, in __getattr__
raise AttributeError
AttributeError
The error come from the bellow code line from the file default.py
db.task.title.represent = lambda title, row:A(title, _href=URL('view_task',
args=row.id))
If I remove the previous row the export function work for all format but I
lose the cliquable link on the task title.
I checked with the Notifier application available on GitHub
https://github.com/mdipierro/web2py-appliances/tree/master/Notifier and I
see the same problem.
If you can help me it's very appreciate.
Kind regards
Olivier
--
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.