|
15 | 15 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
16 | 16 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
17 | 17 | # |
18 | | -# $Id: cgi_client.py,v 1.136 2002-07-10 06:51:08 richard Exp $ |
| 18 | +# $Id: cgi_client.py,v 1.137 2002-07-10 07:00:30 richard Exp $ |
19 | 19 |
|
20 | 20 | __doc__ = """ |
21 | 21 | WWW request handler (also used in the stand-alone server). |
@@ -44,6 +44,9 @@ class Client: |
44 | 44 | 'anonymous' user exists, the user is logged in using that user (though |
45 | 45 | there is no cookie). This allows them to modify the database, and all |
46 | 46 | modifications are attributed to the 'anonymous' user. |
| 47 | +
|
| 48 | + Once a user logs in, they are assigned a session. The Client instance |
| 49 | + keeps the nodeid of the session as the "session" attribute. |
47 | 50 | ''' |
48 | 51 |
|
49 | 52 | def __init__(self, instance, request, env, form=None): |
@@ -1164,7 +1167,8 @@ def set_cookie(self, user, password): |
1164 | 1167 | print 'session set to', `session` |
1165 | 1168 |
|
1166 | 1169 | # insert the session in the sessiondb |
1167 | | - self.db.getclass('__sessions').create(sessid=session, user=user, |
| 1170 | + sessions = self.db.getclass('__sessions') |
| 1171 | + self.session = sessions.create(sessid=session, user=user, |
1168 | 1172 | last_use=date.Date()) |
1169 | 1173 |
|
1170 | 1174 | # and commit immediately |
@@ -1239,19 +1243,17 @@ def main(self): |
1239 | 1243 | user = 'anonymous' |
1240 | 1244 | if (cookie.has_key('roundup_user') and |
1241 | 1245 | cookie['roundup_user'].value != 'deleted'): |
1242 | | - print cookie |
1243 | 1246 |
|
1244 | 1247 | # get the session key from the cookie |
1245 | 1248 | session = cookie['roundup_user'].value |
1246 | | - print 'session is', `session` |
1247 | 1249 |
|
1248 | 1250 | # get the user from the session |
1249 | 1251 | try: |
1250 | | - sessid = sessions.lookup(session) |
| 1252 | + self.session = sessions.lookup(session) |
1251 | 1253 | except KeyError: |
1252 | 1254 | user = 'anonymous' |
1253 | 1255 | else: |
1254 | | - sessions.set(sessid, last_use=date.Date()) |
| 1256 | + sessions.set(self.session, last_use=date.Date()) |
1255 | 1257 | self.db.commit() |
1256 | 1258 | user = sessions.get(sessid, 'user') |
1257 | 1259 |
|
@@ -1494,6 +1496,9 @@ def parsePropsFromForm(db, cl, form, nodeid=0, num_re=re.compile('^\d+$')): |
1494 | 1496 |
|
1495 | 1497 | # |
1496 | 1498 | # $Log: not supported by cvs2svn $ |
| 1499 | +# Revision 1.136 2002/07/10 06:51:08 richard |
| 1500 | +# . #576241 ] MultiLink problems in parsePropsFromForm |
| 1501 | +# |
1497 | 1502 | # Revision 1.135 2002/07/10 00:22:34 richard |
1498 | 1503 | # . switched to using a session-based web login |
1499 | 1504 | # |
|
0 commit comments