Mercurial > p > roundup > code
comparison roundup/cgi/client.py @ 1697:c9f67f2f7ba7
don't open the database for static files
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 24 Jun 2003 05:00:43 +0000 |
| parents | 64f448ff07f2 |
| children | eeb167fb8faf |
comparison
equal
deleted
inserted
replaced
| 1696:38f9578de0c6 | 1697:c9f67f2f7ba7 |
|---|---|
| 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 __doc__ = """ | 3 __doc__ = """ |
| 4 WWW request handler (also used in the stand-alone server). | 4 WWW request handler (also used in the stand-alone server). |
| 5 """ | 5 """ |
| 6 | 6 |
| 230 percolates up to the CGI interface that called the client | 230 percolates up to the CGI interface that called the client |
| 231 ''' | 231 ''' |
| 232 self.ok_message = [] | 232 self.ok_message = [] |
| 233 self.error_message = [] | 233 self.error_message = [] |
| 234 try: | 234 try: |
| 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 | |
| 239 self.determine_context() | |
| 240 | |
| 235 # make sure we're identified (even anonymously) | 241 # make sure we're identified (even anonymously) |
| 236 self.determine_user() | 242 self.determine_user() |
| 237 # figure out the context and desired content template | 243 |
| 238 self.determine_context() | |
| 239 # possibly handle a form submit action (may change self.classname | 244 # possibly handle a form submit action (may change self.classname |
| 240 # and self.template, and may also append error/ok_messages) | 245 # and self.template, and may also append error/ok_messages) |
| 241 self.handle_action() | 246 self.handle_action() |
| 242 | 247 |
| 243 # now render the page | 248 # now render the page |
| 310 sessions.set('last_clean', last_use=time.time()) | 315 sessions.set('last_clean', last_use=time.time()) |
| 311 | 316 |
| 312 def determine_user(self): | 317 def determine_user(self): |
| 313 ''' Determine who the user is | 318 ''' Determine who the user is |
| 314 ''' | 319 ''' |
| 315 # determine the uid to use | |
| 316 self.opendb('admin') | |
| 317 # clean age sessions | 320 # clean age sessions |
| 318 self.clean_sessions() | 321 self.clean_sessions() |
| 319 # make sure we have the session Class | 322 # make sure we have the session Class |
| 320 sessions = self.db.sessions | 323 sessions = self.db.sessions |
| 321 | 324 |
| 420 else: | 423 else: |
| 421 self.classname = path[0] | 424 self.classname = path[0] |
| 422 if len(path) > 1: | 425 if len(path) > 1: |
| 423 # send the file identified by the designator in path[0] | 426 # send the file identified by the designator in path[0] |
| 424 raise SendFile, path[0] | 427 raise SendFile, path[0] |
| 428 | |
| 429 # we need the db for further context stuff - open it as admin | |
| 430 self.opendb('admin') | |
| 425 | 431 |
| 426 # see if we got a designator | 432 # see if we got a designator |
| 427 m = dre.match(self.classname) | 433 m = dre.match(self.classname) |
| 428 if m: | 434 if m: |
| 429 self.classname = m.group(1) | 435 self.classname = m.group(1) |
