Skip to content

Commit 71328dd

Browse files
author
Richard Jones
committed
don't open the database for static files (backport from HEAD)
1 parent 7c05683 commit 71328dd

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

roundup/cgi/client.py

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

33
__doc__ = """
44
WWW request handler (also used in the stand-alone server).
@@ -169,10 +169,15 @@ def inner_main(self):
169169
self.ok_message = []
170170
self.error_message = []
171171
try:
172-
# make sure we're identified (even anonymously)
173-
self.determine_user()
174172
# 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
175176
self.determine_context()
177+
178+
# make sure we're identified (even anonymously)
179+
self.determine_user()
180+
176181
# possibly handle a form submit action (may change self.classname
177182
# and self.template, and may also append error/ok_messages)
178183
self.handle_action()
@@ -212,9 +217,7 @@ def inner_main(self):
212217
def determine_user(self):
213218
''' Determine who the user is
214219
'''
215-
# determine the uid to use
216-
self.opendb('admin')
217-
220+
# clean age sessions
218221
self.clean_sessions()
219222

220223
# make sure we have the session Class
@@ -331,6 +334,9 @@ def determine_context(self, dre=re.compile(r'([^\d]+)(\d+)')):
331334
# send the file identified by the designator in path[0]
332335
raise SendFile, path[0]
333336

337+
# we need the db for further context stuff - open it as admin
338+
self.opendb('admin')
339+
334340
# see if we got a designator
335341
m = dre.match(self.classname)
336342
if m:

0 commit comments

Comments
 (0)