I've loaded a bunch of data into the DB, and some of the tables and rows 
has the datetime field "0000-00-00"

That caused web2py admin > this app's database to raise an error because of 
the datetime field:
"year is out of range"

(1) I tried to use filter_out on the field but it is not working. What can 
I do for this error?

    def filter_out_datetime(table, fields):
def check_datetime(self, dt):
if dt=='0000-00-00 00:00:00':
return ''
else:
return dt
for field in fields:
db[table][field].filter_out = lambda val, cdt=check_datetime: cdt(val)

(2) Is there a way to retrieve all fields of "datetime" type in web2py? I 
have a number of such fields across the many tables. And may be adding 
more...

(3) How do I use SQLCustomType for this use case?


Thank you!

-- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to