comparison roundup/cgi/client.py @ 2939:e8d22f8ff35a maint-0.7

determine user before context: SendFile exception handler requires initialized userid attribute. (thanks alex)
author Richard Jones <richard@users.sourceforge.net>
date Sun, 21 Nov 2004 21:52:34 +0000
parents 1629b3e303d2
children 1836d2361553
comparison
equal deleted inserted replaced
2919:07166758e412 2939:e8d22f8ff35a
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 $
2 2
3 """WWW request handler (also used in the stand-alone server). 3 """WWW request handler (also used in the stand-alone server).
4 """ 4 """
5 __docformat__ = 'restructuredtext' 5 __docformat__ = 'restructuredtext'
6 6
185 percolates up to the CGI interface that called the client 185 percolates up to the CGI interface that called the client
186 ''' 186 '''
187 self.ok_message = [] 187 self.ok_message = []
188 self.error_message = [] 188 self.error_message = []
189 try: 189 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
196 # make sure we're identified (even anonymously) 190 # make sure we're identified (even anonymously)
197 self.determine_user() 191 self.determine_user()
192
193 # figure out the context and desired content template
194 self.determine_context()
198 195
199 # possibly handle a form submit action (may change self.classname 196 # possibly handle a form submit action (may change self.classname
200 # and self.template, and may also append error/ok_messages) 197 # and self.template, and may also append error/ok_messages)
201 html = self.handle_action() 198 html = self.handle_action()
202 199
399 self.classname = path[0] 396 self.classname = path[0]
400 if len(path) > 1: 397 if len(path) > 1:
401 # send the file identified by the designator in path[0] 398 # send the file identified by the designator in path[0]
402 raise SendFile, path[0] 399 raise SendFile, path[0]
403 400
404 # we need the db for further context stuff - open it as admin
405 self.opendb('admin')
406
407 # see if we got a designator 401 # see if we got a designator
408 m = dre.match(self.classname) 402 m = dre.match(self.classname)
409 if m: 403 if m:
410 self.classname = m.group(1) 404 self.classname = m.group(1)
411 self.nodeid = m.group(2) 405 self.nodeid = m.group(2)
433 m = dre.match(str(designator)) 427 m = dre.match(str(designator))
434 if not m: 428 if not m:
435 raise NotFound, str(designator) 429 raise NotFound, str(designator)
436 classname, nodeid = m.group(1), m.group(2) 430 classname, nodeid = m.group(1), m.group(2)
437 431
438 self.opendb('admin')
439 klass = self.db.getclass(classname) 432 klass = self.db.getclass(classname)
440 433
441 # make sure we have the appropriate properties 434 # make sure we have the appropriate properties
442 props = klass.getprops() 435 props = klass.getprops()
443 if not props.has_key('type'): 436 if not props.has_key('type'):

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