I've gotten it back working as before
Here's what i did
As i say i using an class called sec_auth
that i have since the pre-spyce days of cgi and cookies (it has the
salt and the encryption method etc. for each project)
the login method performs the select on the user attributes table
select * from user_attributes where
user_name=login and password=password
this puts results in in the dictionary called auth
My config.py file looks likes
#my_auth is an instance of the sec_auth
udata = myauth.login(login,password)
in parent.spi i have
from spyceConfig import udata
if not session.get('udata') and udata:
session['udata'] = udata
You are logged in to SMW as [[=session['udata']['name'] ]]
I realize that i have to put the udata in the session since if the
server restarts and i am logged in already then udata is none
The advantage of the login_tags is that think i can easily implement
who's on line,user active count etc.
since i can store the session_id and the associated id in my sessions
One potential problem?
If i logout of one site do i logout of all sites (cookie.delete
On 26 Jun 2007, at 13:23, Jonathan Ellis wrote:
> On Tue, 26 Jun 2007 12:45:27 -0400, "Christopher Clarke"
> <cclarke@...> said:
>> In switching to the login tag i was attempting to access the session
>> from the config.py
>> But i just colud not get a handle on it (the session that is).
>> I've tried
>> session['user_data'] = udata #udata is a dict of user attributes
>> It appears to work but when i try to access this from the page i get
>> an invalid key error
>> I've used the session in my active handlers by using api.session
>> how do i and set session variable from config.py>>
> You can't, there's no active session there, sessions are per request.
> What is the active request in config.py? There is none.
>> In any case is this the best way to achieve what i am trying to do???
> Most frameworks do this by putting session data in a database and
> querying that. So you could either write a DB session backend and do
> that, or you could use os.stat on the session files generated by the
> existing FS-based backend to get the mtimes.