unless user roles are defined or a special self __init is involved, there is
not other way to do it that is common practice.

actually def logged would work well in a global __init__ and could def roles
under it if needed???

maybe we all need to go to school?
-----------------------
Visit My Sites!
http://1-4-u.info | Don't send insanely long links!
www.syrbot.com | My Site
www.syrbotwebdesign.com | My Site New Design (Under Construction)
www.attackr.com | Latest Blog Posts
www.superantispyware.com/superantispyware.html?rid=3971 Remove All The
Spyware - Not Just The Easy Ones!



On Mon, Mar 8, 2010 at 1:31 PM, Branko Vukelic <[email protected]> wrote:

> On Mon, Mar 8, 2010 at 4:20 PM, Colin <[email protected]> wrote:
> > The "User Authentication with PostgreSQL database" tutorial in
> > web.py's documentation includes the following function:
> >
> > def logged():
> >    if session.login==1:
> >        return True
> >    else:
> >        return False
> >
> > Which is execrable, and the kind of thing you learn to stop writing in
> > a first-year programming course. For the sake of encouraging good
> > coding habits and having documentation that reflects well on web.py,
> > I'd suggest changing this to the one-liner that it should be.
>
> I never went to school, and I'm not a very experienced Pythonista, so
> I have to ask, for the sake of learning:
>
> What is bad about it?
>
> I myself would:
>
> store truth value in session.login, so that it returns useful data if
> it's True (like if session.login == user record, then it's True and we
> get useful info as a bonus), and of course, if it's None, then it's
> False at the same time.
>
> --
> Branko Vukelić
>
> http://foxbunny.tumblr.com/
> http://www.flickr.com/photos/16889...@n04/
> http://www.twitter.com/foxbunny
> http://github.com/foxbunny
>
> --
> You received this message because you are subscribed to the Google Groups
> "web.py" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected] <webpy%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to