|
1 | | -# $Id: client.py,v 1.65.2.11 2003-06-24 04:23:35 anthonybaxter Exp $ |
| 1 | +# $Id: client.py,v 1.65.2.12 2003-06-24 05:02:45 richard Exp $ |
2 | 2 |
|
3 | 3 | __doc__ = """ |
4 | 4 | WWW request handler (also used in the stand-alone server). |
@@ -169,10 +169,15 @@ def inner_main(self): |
169 | 169 | self.ok_message = [] |
170 | 170 | self.error_message = [] |
171 | 171 | try: |
172 | | - # make sure we're identified (even anonymously) |
173 | | - self.determine_user() |
174 | 172 | # figure out the context and desired content template |
| 173 | + # do this first so we don't authenticate for static files |
| 174 | + # Note: this method opens the database as "admin" in order to |
| 175 | + # perform context checks |
175 | 176 | self.determine_context() |
| 177 | + |
| 178 | + # make sure we're identified (even anonymously) |
| 179 | + self.determine_user() |
| 180 | + |
176 | 181 | # possibly handle a form submit action (may change self.classname |
177 | 182 | # and self.template, and may also append error/ok_messages) |
178 | 183 | self.handle_action() |
@@ -212,9 +217,7 @@ def inner_main(self): |
212 | 217 | def determine_user(self): |
213 | 218 | ''' Determine who the user is |
214 | 219 | ''' |
215 | | - # determine the uid to use |
216 | | - self.opendb('admin') |
217 | | - |
| 220 | + # clean age sessions |
218 | 221 | self.clean_sessions() |
219 | 222 |
|
220 | 223 | # make sure we have the session Class |
@@ -331,6 +334,9 @@ def determine_context(self, dre=re.compile(r'([^\d]+)(\d+)')): |
331 | 334 | # send the file identified by the designator in path[0] |
332 | 335 | raise SendFile, path[0] |
333 | 336 |
|
| 337 | + # we need the db for further context stuff - open it as admin |
| 338 | + self.opendb('admin') |
| 339 | + |
334 | 340 | # see if we got a designator |
335 | 341 | m = dre.match(self.classname) |
336 | 342 | if m: |
|
0 commit comments