Massimo,
have the below as the db.py in GAE and at the time of startup the
error throws up

db.py
=======
try:
    from gluon.contrib.gql import *  # if running on Google App Engine
except:
    db = SQLDB('sqlite://storage.db')  # if not, use SQLite or other
DB
else:
    db = GQLDB()  # connect to Google BigTable
    session.connect(request, response, db=db)  # and store sessions
there


import datetime; now=datetime.date.today()

db.define_table('cases',
    SQLField('title'),
    SQLField('created_time', 'datetime', default=now)
    )

db.cases.insert(title='testing', created_time=now)

===============================end of db.py==================
error:

    str(obj)[11:].strip().split(':')[:3]]
ValueError: invalid literal for int() with base 10: ''



I'm using web2py: Version 1.56.2 (2009-02-08 21:49:34)
on GAE: release: "1.1.9" / timestamp: 1232676672 / api_versions: ['1']
on kubuntu

thanks,
Joseph

On Feb 23, 9:05 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Can you tell me how to reproduce it?
>
> On Feb 23, 9:50 am, Robin B <robi...@gmail.com> wrote:
>
> > It looks like a problem converting datetimes to/from strings?
>
> > Robin
>
> > On Feb 23, 9:21 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > Robin,
>
> > > what is the bug?
>
> > > Massimo
>
> > > On Feb 23, 9:04 am, Robin B <robi...@gmail.com> wrote:
>
> > > > Looks like the type coercion code was last modified in r725.
>
> > > >http://code.google.com/p/web2py/source/diff?spec=svn743&r=725&format=...
>
> > > > If the bug is not in 1.56.2, try using 1.56.2 until this can be fixed/
> > > > patched.
>
> > > > Robin
>
> > > > On Feb 23, 8:08 am, Joseph Jude <ceph...@gmail.com> wrote:
>
> > > > > Okay with little bit of search, I found that,
> > > > > -In GAE, one can't select a single field; so I selected all fields
> > > > > (db.priority.ALL) and the error 1 vanished.
> > > > > -In GAE, datetime field throws up error. I removed datetime fields,
> > > > > and I didn't get any error. Once I introduce the datetime field in db
> > > > > model, the error is back. It is not only with null value; even when I
> > > > > try to insert a value, I get the same error.
>
> > > > > Any help?
>
> > > > > Thank you,
> > > > > Joseph
>
> > > > > On Feb 23, 3:34 pm, Cephire <ceph...@gmail.com> wrote:
>
> > > > > > All,
> > > > > > I'm trying out with web2py. It worked okay in the local web2py 
> > > > > > server;
> > > > > > however when I tried with GAE (again local), I get few errors. 
> > > > > > Please
> > > > > > help in resolving this. Thank you.
>
> > > > > > Models
> > > > > > ========
>
> > > > > > db.define_table('status', SQLField('name'))
>
> > > > > > db.define_table('priority', SQLField('name'))
>
> > > > > > db.define_table('cases',
> > > > > >     SQLField('title'),
> > > > > >     SQLField('description', 'text', length=256),
> > > > > >     SQLField('status', db.status),
> > > > > >     SQLField('priority', db.priority),
> > > > > >     SQLField('created_by', db.auth_user),
> > > > > >     SQLField('created_time', 'datetime', default=now),
> > > > > >     SQLField('last_modified_by', db.auth_user),
> > > > > >     SQLField('last_modified_time', 'datetime', default=now)
> > > > > >     )
>
> > > > > > db.cases.priority.requires=IS_IN_DB(db, 
> > > > > > 'priority.id','priority.name')
> > > > > > db.cases.created_by.required=IS_IN_DB(db, 'auth_user.id')
> > > > > > db.cases.title.requires=[IS_NOT_EMPTY()]
> > > > > > db.cases.description.requires=[IS_NOT_EMPTY()]
>
> > > > > > controller
> > > > > > ==========
> > > > > > @auth.requires_login()
> > > > > > def create():
> > > > > >     priority_values=[]
> > > > > >     for pr in db().select(db.priority.name):
> > > > > >             priority_values.append(pr['name'])
>
> > > > > >     status_values=[]
> > > > > >     for st in db().select(db.status.name):
> > > > > >             status_values.append(st['name'])
>
> > > > > >     form=FORM(TABLE(TR("Title:",INPUT(_type="text",_name="title",
> > > > > > requires=IS_NOT_EMPTY())),
> > > > > >                     TR("Status:", status_values[0]),
> > > > > >                     TR("Priority:", 
> > > > > > SELECT(priority_values,_name='priority',
> > > > > > requires=IS_IN_SET(priority_values))),
> > > > > >                     TR("Description:", 
> > > > > > TEXTAREA(_name='description')),
> > > > > >                     TR("Created By:", auth.user.email),
> > > > > >                     TR("",INPUT(_type="submit", _value="Create"))
> > > > > >         ))
> > > > > >     if form.accepts(request.vars, session):
> > > > > >         #insert into the record
> > > > > >         #dict index starts with 0; record id starts with 1
> > > > > >         db.cases.insert(title=form.vars.title, status=1,
> > > > > > priority=priority_values.index(form.vars.priority)+1,
> > > > > > description=form.vars.description,created_by=auth.user.id,
> > > > > > last_modified_by=auth.user.id)
> > > > > >         redirect(URL(r=request, f='index'))
> > > > > >     return dict(form=form)
>
> > > > > > Error 1:
> > > > > > SyntaxError: SQLSet: no tables selected
> > > > > > at line
> > > > > > for pr in db().select(db.priority.name):
>
> > > > > > Error 2:
> > > > > > I changed the insert line into the below:
>
> > > > > > db.cases.insert(title="test title",  priority=1, created_by=12,
> > > > > > description="test description")
>
> > > > > > 1 & 12 are the IDs in the respective tables in google datastore
>
> > > > > > and I get this error:
>
> > > > > >     str(obj)[11:].strip().split(':')[:3]]
> > > > > > ValueError: invalid literal for int() with base 10: ''
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to