|
1 | | -# $Id: client.py,v 1.123 2003-06-24 04:16:35 richard Exp $ |
| 1 | +# $Id: client.py,v 1.124 2003-06-24 05:00:43 richard Exp $ |
2 | 2 |
|
3 | 3 | __doc__ = """ |
4 | 4 | WWW request handler (also used in the stand-alone server). |
@@ -232,10 +232,15 @@ def inner_main(self): |
232 | 232 | self.ok_message = [] |
233 | 233 | self.error_message = [] |
234 | 234 | try: |
235 | | - # make sure we're identified (even anonymously) |
236 | | - self.determine_user() |
237 | 235 | # figure out the context and desired content template |
| 236 | + # do this first so we don't authenticate for static files |
| 237 | + # Note: this method opens the database as "admin" in order to |
| 238 | + # perform context checks |
238 | 239 | self.determine_context() |
| 240 | + |
| 241 | + # make sure we're identified (even anonymously) |
| 242 | + self.determine_user() |
| 243 | + |
239 | 244 | # possibly handle a form submit action (may change self.classname |
240 | 245 | # and self.template, and may also append error/ok_messages) |
241 | 246 | self.handle_action() |
@@ -312,8 +317,6 @@ def clean_sessions(self): |
312 | 317 | def determine_user(self): |
313 | 318 | ''' Determine who the user is |
314 | 319 | ''' |
315 | | - # determine the uid to use |
316 | | - self.opendb('admin') |
317 | 320 | # clean age sessions |
318 | 321 | self.clean_sessions() |
319 | 322 | # make sure we have the session Class |
@@ -423,6 +426,9 @@ def determine_context(self, dre=re.compile(r'([^\d]+)(\d+)')): |
423 | 426 | # send the file identified by the designator in path[0] |
424 | 427 | raise SendFile, path[0] |
425 | 428 |
|
| 429 | + # we need the db for further context stuff - open it as admin |
| 430 | + self.opendb('admin') |
| 431 | + |
426 | 432 | # see if we got a designator |
427 | 433 | m = dre.match(self.classname) |
428 | 434 | if m: |
|
0 commit comments