in my db.py I have import datetime rom time import mktime, localtime timestamp = SQLCustomType(type='datetime', native='NUMERIC(16,6)', encoder=(lambda x: str(mktime(x.timetuple()) + x.microsecond/1000000.0 if x else None)), decoder=(lambda x: datetime.datetime(* (list(localtime(int(x))[:6])+[int(round(x%1,6)*1000000)]) ) if x else None))
I then use timestamp for various fields. In /admin when attempt to update a row this is kicked out: File "E:/projects/workspace/TestEnvoy/web2py/applications/init/models/ db.py", line 39, in <lambda> encoder=(lambda x: str(mktime(x.timetuple()) + x.microsecond/ 1000000.0 if x else None)), AttributeError: 'str' object has no attribute 'timetuple' Any idea where I've gone a stray?