Will do On 20 Sep 2010, at 14:35, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Can you please try trunk? > > On Sep 20, 8:09 am, Carl <carl.ro...@gmail.com> wrote: >> It took a bit of binary upgrading to pin down this issue but I#ve >> found that it's between 1.84.4 and 1.85.1 >> >> However since 1.85.1 (thru to 1.85.3) selects and inserts to the >> datastore fail when I use a SQLCustom definition (see details below). >> >> On dev_appserver all continues to work fine. >> But locally on sqlite... operations on the datastore fail at gluon/ >> sql.py (in v1.85.1 it's line 3323) class Set, parse() after line "elif >> field_type == 'datetime'\" >> (y, m, d) = [int(x) for x in str(value)[:10].strip().split('-')] >> ValueError: need more than 1 value to unpack >> >> Background: >> Locally Web2py drops the microseconds from datetime. On GAE it does >> not. >> I need the accuracy so I added the following db.py to define a >> Fieldtype 'timestamp': >> >> if request.env.web2py_runtime_gae: >> from gluon.contrib.gql import * >> db = DAL('gae') >> session.connect(request, response, db=db) >> timestamp = 'datetime' >> else: # else use a normal relational database >> db = DAL('sqlite://storage.sqlite') >> from gluon.sql import SQLCustomType >> import datetime >> from time import mktime, localtime >> timestamp = SQLCustomType(type='datetime', >> native='NUMERIC(16,6)', >> encoder=(lambda x: >> str(mktime(x.timetuple()) + x.microsecond/1000000.0)), >> decoder=(lambda x: datetime.datetime(* >> (list(localtime(int(x))[:6])+[int(round(x%1,6)*1000000)]) ))) >> >> Is this definition of timestamp using SQLCustomType no longer >> appropriate/workable? >> Tables that don't include a timestamp field work correct in 1.84.x and >> 1.85.x