This fixes it: def none_exception(value): """ returns a cleaned up value that can be used for csv export: - unicode text is encoded as such - None values are replaced with the given representation (default <NULL>) """ print str(value) if value == None: return null elif isinstance(value, unicode): return value.encode('utf8') elif isinstance(value,DALRef): #<-----------NEW return int(value)#<----------------------------NEW elif hasattr(value, 'isoformat'): return value.isoformat()[:19].replace('T', ' ') return value
On Oct 29, 4:53 pm, "mr.freeze" <nat...@freezable.com> wrote: > I'm pretty sure it's caused by DALRef > > On Oct 29, 4:52 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > Same error. I'll take a closer look. > > > On Oct 29, 4:36 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > > > > uploading fix, please check > > > > On Oct 29, 4:16 pm, "mr.freeze" <nat...@freezable.com> wrote: > > > > > Perhaps because of DALRef? > > > > > >>> rows = db(db.purchase.id>0).select() > > > > >>> for row in rows: > > > > > ... print row > > > > ... > > > > <DALStorage {'product': 5, 'update_record': <function <lambda> at > > > > 0x02E85AF0>, ' > > > > buyer': 9, 'order_date': datetime.date(2009, 10, 10), 'id': 1, > > > > 'quantity': 1}> > > > > <DALStorage {'product': 5, 'update_record': <function <lambda> at > > > > 0x02EFBBF0>, ' > > > > buyer': 10, 'order_date': datetime.date(2009, 10, 11), 'id': 2, > > > > 'quantity': 4}> > > > > > >>> f=open(r"c:\temp\test.txt",'w') > > > > >>> rows.export_to_csv_file(f) > > > > > Traceback (most recent call last): > > > > File "<console>", line 1, in <module> > > > > File "c:\web2py\gluon\sql.py", line 3199, in export_to_csv_file > > > > row.append(none_exception(record[f])) > > > > File "c:\web2py\gluon\sql.py", line 3184, in none_exception > > > > return value.isoformat()[:19].replace('T', ' ') > > > > TypeError: 'NoneType' object is not callable --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---