What does it do?

On Sep 5, 12:42 pm, 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