[albatross-users] Finding Saved Values in Sessions
Mike Barrett
mike at daboyz.org
Sun Aug 18 18:27:46 EST 2002
I just realized that my code samples below aren't all that useful without
some sort of context. Here's a bit larger snippet of the code:
class AppContext(SessionFileAppContext):
def isAuthenticated(self):
self.locals.isAuthenticated = 0
# This returns None (the session file exists in the directory
# I specified though)
self.locals.blah = self.app.get_session(self.sesid())
# This returns the appropriate session id
self.locals.sesid = self.sesid()
#self.locals.isAuthenticated = self.decode_session(self.app.get_session(self.sesid())).has_key('LoginName')
===
I hope this makes more sense of what I'm seeing.
On Sun, Aug 18, 2002 at 01:07:49AM -0700, Mike Barrett wrote:
> Howdy. I'm trying to use albatross for a web application that I'm writing.
> I'm just starting to get into it however, and I already have a question:
>
> How can I check to see if a value is stored in a session? For example when
> someone logs in to my application I have it store the loginName in the session.
>
> What I want to do is have the application check to see if that key/value is
> stored in the session. I tried doing it this way:
>
> ctx.locals.isAuthenticated = ctx.decode_session(ctx.app.get_session(ctx.sesid())).kas_key('loginName')
>
> But it doesn't seem to work. Some other things:
>
> # This seems to work, it returns the session id.
> ctx.locals.sesid = ctx.sesid()
>
> # This doesn't seem to work. It returns 'None'
> ctx.locals.blah = ctx.app.get_session(ctx.sesid())
>
>
> Any idea how I can make this work? I'm using the ModularSessionFileApp and
> SessionFileAppContext modules.
>
> Thanks for any help you can give me. :)
>
> --
> ________________________________________________________________________
> Mike Barrett | "I used to read, now I go to raves."
> mike at daboyz.org | -- Random MUNI Rider, speaking
> www.daboyz.org | to my friend Allison.
> ------------------------+-----------------------------------------------
> _______________________________________________
> Albatross-users mailing list
> Albatross-users at object-craft.com.au
> https://www.object-craft.com.au/cgi-bin/mailman/listinfo/albatross-users
--
________________________________________________________________________
Mike Barrett | "I used to read, now I go to raves."
mike at daboyz.org | -- Random MUNI Rider, speaking
www.daboyz.org | to my friend Allison.
------------------------+-----------------------------------------------
More information about the Albatross-users
mailing list