Fwd: version of class FileStorage for db.
"Rui Miguel Justino" <[email protected]> Sat, 2 Sep 2006 01:10:25 +0100
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
Need help with the implementation of a new class to replace the FileStorage.
My class does exactly what the FileStorage class does but try's to use a
database. My problem is after the login, it does the login and updates the
columns in the db with the respective "token" for the user. After that if i
refresh the page it will create a new "token" and update the old one(I did
tested it in several browsers :-) ). But in the other end if i change the
page it starts to work ok in the two pages not creating a new "token" every
time(what it does is clearing the "post" in the headers).
If it is of any help here is my code(the validator is equal to the one in
spyced blog):
class DBStorage:
def __init__(self, db):
self.dbi = db
def set(self, uid, token):
self.dbi.users.update ( self.dbi.users.c.usersid == uid, userssession =
token )
self.dbi.flush()
def validate(self, uid, token):
try:
return token == self.dbi.users.selectone_by ( usersid = uid
).userssession
except:
return False
I have done several test until now, trying to debug and I'm not able to
identify or give more information that the one i gave.
Thanks rcj
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Spyce-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spyce-users