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