Skip to content

Commit eb72489

Browse files
author
Richard Jones
committed
determine user before context:
SendFile exception handler requires initialized userid attribute. (thanks alex)
1 parent fded2b0 commit eb72489

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

roundup/cgi/client.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.176.2.7 2004-11-05 04:57:50 richard Exp $
1+
# $Id: client.py,v 1.176.2.8 2004-11-21 21:52:34 richard Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -187,15 +187,12 @@ def inner_main(self):
187187
self.ok_message = []
188188
self.error_message = []
189189
try:
190-
# figure out the context and desired content template
191-
# do this first so we don't authenticate for static files
192-
# Note: this method opens the database as "admin" in order to
193-
# perform context checks
194-
self.determine_context()
195-
196190
# make sure we're identified (even anonymously)
197191
self.determine_user()
198192

193+
# figure out the context and desired content template
194+
self.determine_context()
195+
199196
# possibly handle a form submit action (may change self.classname
200197
# and self.template, and may also append error/ok_messages)
201198
html = self.handle_action()
@@ -401,9 +398,6 @@ def determine_context(self, dre=re.compile(r'([^\d]+)(\d+)')):
401398
# send the file identified by the designator in path[0]
402399
raise SendFile, path[0]
403400

404-
# we need the db for further context stuff - open it as admin
405-
self.opendb('admin')
406-
407401
# see if we got a designator
408402
m = dre.match(self.classname)
409403
if m:
@@ -435,7 +429,6 @@ def serve_file(self, designator, dre=re.compile(r'([^\d]+)(\d+)')):
435429
raise NotFound, str(designator)
436430
classname, nodeid = m.group(1), m.group(2)
437431

438-
self.opendb('admin')
439432
klass = self.db.getclass(classname)
440433

441434
# make sure we have the appropriate properties

0 commit comments

Comments
 (0)