Skip to content

Commit 94117bf

Browse files
author
Richard Jones
committed
don't open the database for static files
1 parent df205a5 commit 94117bf

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

roundup/cgi/client.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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 $
22

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -232,10 +232,15 @@ def inner_main(self):
232232
self.ok_message = []
233233
self.error_message = []
234234
try:
235-
# make sure we're identified (even anonymously)
236-
self.determine_user()
237235
# 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
238239
self.determine_context()
240+
241+
# make sure we're identified (even anonymously)
242+
self.determine_user()
243+
239244
# possibly handle a form submit action (may change self.classname
240245
# and self.template, and may also append error/ok_messages)
241246
self.handle_action()
@@ -312,8 +317,6 @@ def clean_sessions(self):
312317
def determine_user(self):
313318
''' Determine who the user is
314319
'''
315-
# determine the uid to use
316-
self.opendb('admin')
317320
# clean age sessions
318321
self.clean_sessions()
319322
# make sure we have the session Class
@@ -423,6 +426,9 @@ def determine_context(self, dre=re.compile(r'([^\d]+)(\d+)')):
423426
# send the file identified by the designator in path[0]
424427
raise SendFile, path[0]
425428

429+
# we need the db for further context stuff - open it as admin
430+
self.opendb('admin')
431+
426432
# see if we got a designator
427433
m = dre.match(self.classname)
428434
if m:

0 commit comments

Comments
 (0)