This does not work because if not request.args you redirect to a url
that does not have request.args and your server gets into an infinite
loop.

You are reinventing the wheel. Why don't you just use auth and
decorate the functions that require a user?

On Sep 5, 11:42 am, annet <[email protected]> wrote:
> In a controller outside all functions I have this code:
>
> session.id
> session.name
>
> if not request.args:
>     redirect(URL(r=request,c='default',f='error'))
> else:
>     if not session.id or session.id!=request.args[0]:
>         session.id=request.args[0]
>         row=db(db.user.id==session.id).select(db.user.name)
>         if row:
>             session.name=row[0].name
>
> The idea is multiple users sharing one app . The menu items in the app
> all have args[0] set to session.id, when session.id hasn't been set or
> args[0] for some reason changes (bookmarked page), the code should set
> the id and name in session to the current user's id and name, who's id
> is in request.args[0].
>
> I thought the code above would exactly do this, but it doesn't, why
> not?
>
> Kind regards,
>
> Annet.

Reply via email to