It can but that is besides the point. You are trying to extract as a
datetime field data that is in string format and not in datetime
format I believe.

data in datetime format should be ISO and should have the proper
length.

It is also possible that you are using sqlite and data got corrupted
during a migration.

If you post the model, I can suggest how to fix data instead of
twiking the code.

Massimo

On May 26, 7:59 am, liugehao <[email protected]> wrote:
> sql.py  line 2153
>            elif field.type == 'datetime' and value != None\
>                  and not isinstance(value, datetime.datetime):
>                 (y, m, d) = [int(x) for x in
>                              str(value)[:10].strip().split('-')]
>                 time_items = [int(x) for x in
>                               str(value)[11:19].strip().split(':')[:
> 3]]
>
> if value =2009-1-1 1:12:2 sqlite3 error:
>
>  File "/home/liugehao/web2py/gluon/sql.py", line 2158, in __getitem__
>     str(value)[11:19].strip().split(':')[:3]]
> ValueError: invalid literal for int() with base 10: ''
>
> can it  changed like this?
>
>            elif field.type == 'datetime' and value != None\
>                  and not isinstance(value, datetime.datetime):
> (y, m, d) = [int(x) for x in
>                              str(value).split(' ')[0].split('-')]
>                 time_items = [int(x) for x in
>                               str(value).split(' ')[1].split(':')[:3]]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to