You should replace IS_NULL_OR by IS_EMPTY_OR, IS_NULL_OR is depricated if I
remember.

I don't see what could be wrong... But I read recently about "test" that
could be conflicting with web2py some how...

But I guest that you try to implement a home made solution to follow logged
on and logged off user... I think you should have a look to comet server a
contrib to web2py that is supposed to allow tracking connection to app.
Nerver used until now...

Richard

On Mon, Feb 13, 2012 at 2:48 AM, weheh <[email protected]> wrote:

> I'm running Version 1.99.2.
>
> # model
> db.define_table('test',
>
> Field('user_id',db.auth_user,requires=IS_NULL_OR(IS_IN_DB(db,'auth_user.id
> '))),
>  Field('session_id',default=resposne.session_id),
> ...
> )
>
>
> # at some point, the following would be executed:
>
> test_id=db.test.insert(
>  user_id=auth.user.id if auth.is_logged_in() else None,
> )
>
>
> # in the index controller there is the following test condition
> def index():
> ...
>    if auth.is_logged_in():
>        db((db.test.user_id==None) &
> (db.test.session_id==response.session_id)).update(user_id=auth.user.id
> ,session_id=None)
>
> ...
>
> Here's the problem. db.test.user_id is getting properly updated to the
> logged in auth.user.id. However, session_id is not getting set to
> None. Anybody see what I could be doing wrong?
>

Reply via email to