In addition to the previous, we support disabling the default export methods with something like tsv=False but doing csv=True was never supported. I think what you're trying to get is with exportclasses=dict( csv_with_hidden_cols=False, xml=False, json=False, tsv_with_hidden_cols=False, tsv=False) Basically you can build your own export class and pass it into the dict or disable what you don't need setting the corresponding key to False, but NOT setting it to True.
On Saturday, September 7, 2013 3:39:22 PM UTC+2, Niphlod wrote: > > uhm. does it work in trunk ? I don't remember where we introduced the > exportclasses syntax that you're using, but maybe it has been inserted > after 2.5.1 was released. > > On Saturday, September 7, 2013 2:47:53 PM UTC+2, Loïc wrote: >> >> Hi there, >> >> I have a controller which shows some fields of my database : >> >> @auth.requires(auth.has_membership('manager') or auth.has_membership( >> 'event_manager')) >> def edit_contacts_calendar(): >> db.calendar_contact.event.readable = db.calendar_contact.event.writable >> = True >> linked_tables=['calendar_event'] >> fields=[db.calendar_contact.name,db.calendar_contact.email, db. >> calendar_contact.phone_number, db.calendar_contact.address, db. >> calendar_contact.event] >> orderby = db.calendar_contact.name >> exportclasses=dict( >> csv_with_hidden_cols=False, >> xml=False, >> html=True, >> csv=True, >> json=False, >> tsv_with_hidden_cols=False, >> tsv=False) >> grid = SQLFORM.smartgrid(db.calendar_contact, >> linked_tables=linked_tables, >> exportclasses=exportclasses, >> orderby=orderby, >> fields=fields) >> return dict(grid=grid) >> >> The form works fine, but I have a problem with export function. When I >> click on Export: csv or Export: html I get the folowing error : >> Ticket ID >> >> 127.0.0.1.2013-09-07.14-41-29.1dd37213-a82f-4dea-a7a7-cd01a4943313 >> <type 'exceptions.TypeError'> 'bool' object is not >> callableVersionweb2py™Version >> 2.5.1-stable+timestamp.2013.06.06.15.39.19PythonPython 2.7.5: >> C:\Python27\python.exe (prefix: C:\Python27)Traceback >> >> 1. >> 2. >> 3. >> 4. >> 5. >> 6. >> 7. >> 8. >> 9. >> 10. >> 11. >> 12. >> 13. >> 14. >> 15. >> 16. >> >> Traceback (most recent call last): >> File "D:\Google Drive\web2py\gluon\restricted.py", line 212, in restricted >> exec ccode in environment >> File "D:/Google Drive/web2py/applications/udsp25/controllers/calendar.py" >> <http://127.0.0.1:8000/admin/default/edit/udsp25/controllers/calendar.py>, >> line 170, in <module> >> File "D:\Google Drive\web2py\gluon\globals.py", line 194, in <lambda> >> self._caller = lambda f: f() >> File "D:\Google Drive\web2py\gluon\tools.py", line 3022, in f >> return action(*a, **b) >> File "D:/Google Drive/web2py/applications/udsp25/controllers/calendar.py" >> <http://127.0.0.1:8000/admin/default/edit/udsp25/controllers/calendar.py>, >> line 168, in edit_contacts_calendar >> fields=fields) >> File "D:\Google Drive\web2py\gluon\sqlhtml.py", line 2679, in smartgrid >> user_signature=user_signature, **kwargs) >> File "D:\Google Drive\web2py\gluon\sqlhtml.py", line 2147, in grid >> oExp = clazz(rows) >> TypeError: 'bool' object is not callable >> >> >> The corresponding table : >> db.define_table('calendar_contact', >> Field('name', label=T('Name'), notnull=True), >> Field('email', requires=IS_EMAIL(), label=T('Email')), >> Field('phone_number', requires=IS_NULL_OR(IS_MATCH('[\d\-\+\(\)\.\ >> ]+')), label=T('Phone number')), >> Field('address', 'text', label=T('Address')), >> Field('event', 'reference calendar_event', label=T('Event'), readable >> =False, writable=False), >> format='%(name)s' >> ) >> >> >> Any idea? >> Thank you >> > -- --- 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/groups/opt_out.