comparison roundup/cgi/client.py @ 1698:25ffe34775f1 maint-0.5

don't open the database for static files (backport from HEAD)
author Richard Jones <richard@users.sourceforge.net>
date Tue, 24 Jun 2003 05:02:45 +0000
parents 03170eb33b82
children b6d0cc670060
comparison
equal deleted inserted replaced
1695:5f74d65e45d1 1698:25ffe34775f1
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 __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
167 percolates up to the CGI interface that called the client 167 percolates up to the CGI interface that called the client
168 ''' 168 '''
169 self.ok_message = [] 169 self.ok_message = []
170 self.error_message = [] 170 self.error_message = []
171 try: 171 try:
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
176 self.determine_context()
177
172 # make sure we're identified (even anonymously) 178 # make sure we're identified (even anonymously)
173 self.determine_user() 179 self.determine_user()
174 # figure out the context and desired content template 180
175 self.determine_context()
176 # possibly handle a form submit action (may change self.classname 181 # possibly handle a form submit action (may change self.classname
177 # and self.template, and may also append error/ok_messages) 182 # and self.template, and may also append error/ok_messages)
178 self.handle_action() 183 self.handle_action()
179 # now render the page 184 # now render the page
180 185
210 self.write(cgitb.html()) 215 self.write(cgitb.html())
211 216
212 def determine_user(self): 217 def determine_user(self):
213 ''' Determine who the user is 218 ''' Determine who the user is
214 ''' 219 '''
215 # determine the uid to use 220 # clean age sessions
216 self.opendb('admin')
217
218 self.clean_sessions() 221 self.clean_sessions()
219 222
220 # make sure we have the session Class 223 # make sure we have the session Class
221 sessions = self.db.sessions 224 sessions = self.db.sessions
222 225
328 else: 331 else:
329 self.classname = path[0] 332 self.classname = path[0]
330 if len(path) > 1: 333 if len(path) > 1:
331 # send the file identified by the designator in path[0] 334 # send the file identified by the designator in path[0]
332 raise SendFile, path[0] 335 raise SendFile, path[0]
336
337 # we need the db for further context stuff - open it as admin
338 self.opendb('admin')
333 339
334 # see if we got a designator 340 # see if we got a designator
335 m = dre.match(self.classname) 341 m = dre.match(self.classname)
336 if m: 342 if m:
337 self.classname = m.group(1) 343 self.classname = m.group(1)

Roundup Issue Tracker: http://roundup-tracker.org/