@@ -48,7 +48,7 @@ def clean_message_callback(match, ok={'a':1,'i':1,'b':1,'br':1}):
4848 return '<%s>' % match .group (2 )
4949
5050
51- error_message = """<html><head><title>An error has occurred</title></head>
51+ error_message = '' """<html><head><title>An error has occurred</title></head>
5252<body><h1>An error has occurred</h1>
5353<p>A problem was encountered processing your request.
5454The tracker maintainers have been notified of the problem.</p>
@@ -431,41 +431,50 @@ def inner_main(self):
431431 self .determine_charset ()
432432 self .determine_language ()
433433
434- # make sure we're identified (even anonymously)
435- self .determine_user ()
436-
437- # figure out the context and desired content template
438- self .determine_context ()
439-
440- # possibly handle a form submit action (may change self.classname
441- # and self.template, and may also append error/ok_messages)
442- html = self .handle_action ()
443-
444- if html :
445- self .write_html (html )
446- return
447-
448- # now render the page
449- # we don't want clients caching our dynamic pages
450- self .additional_headers ['Cache-Control' ] = 'no-cache'
451- # Pragma: no-cache makes Mozilla and its ilk double-load all pages!!
452- # self.additional_headers['Pragma'] = 'no-cache'
453-
454- # pages with messages added expire right now
455- # simple views may be cached for a small amount of time
456- # TODO? make page expire time configurable
457- # <rj> always expire pages, as IE just doesn't seem to do the
458- # right thing here :(
459- date = time .time () - 1
460- #if self.error_message or self.ok_message:
461- # date = time.time() - 1
462- #else:
463- # date = time.time() + 5
464- self .additional_headers ['Expires' ] = rfc822 .formatdate (date )
465-
466- # render the content
467434 try :
435+ # make sure we're identified (even anonymously)
436+ self .determine_user ()
437+
438+ # figure out the context and desired content template
439+ self .determine_context ()
440+
441+ # possibly handle a form submit action (may change self.classname
442+ # and self.template, and may also append error/ok_messages)
443+ html = self .handle_action ()
444+
445+ if html :
446+ self .write_html (html )
447+ return
448+
449+ # now render the page
450+ # we don't want clients caching our dynamic pages
451+ self .additional_headers ['Cache-Control' ] = 'no-cache'
452+ # Pragma: no-cache makes Mozilla and its ilk
453+ # double-load all pages!!
454+ # self.additional_headers['Pragma'] = 'no-cache'
455+
456+ # pages with messages added expire right now
457+ # simple views may be cached for a small amount of time
458+ # TODO? make page expire time configurable
459+ # <rj> always expire pages, as IE just doesn't seem to do the
460+ # right thing here :(
461+ date = time .time () - 1
462+ #if self.error_message or self.ok_message:
463+ # date = time.time() - 1
464+ #else:
465+ # date = time.time() + 5
466+ self .additional_headers ['Expires' ] = rfc822 .formatdate (date )
467+
468+ # render the content
468469 self .write_html (self .renderContext ())
470+ except SendFile , designator :
471+ # The call to serve_file may result in an Unauthorised
472+ # exception or a NotModified exception. Those
473+ # exceptions will be handled by the outermost set of
474+ # exception handlers.
475+ self .serve_file (designator )
476+ except SendStaticFile , file :
477+ self .serve_static_file (str (file ))
469478 except IOError :
470479 # IOErrors here are due to the client disconnecting before
471480 # recieving the reply.
@@ -481,27 +490,17 @@ def inner_main(self):
481490 self .additional_headers ['Location' ] = str (url )
482491 self .response_code = 302
483492 self .write_html ('Redirecting to <a href="%s">%s</a>' % (url , url ))
484- except SendFile , designator :
485- try :
486- self .serve_file (designator )
487- except NotModified :
488- # send the 304 response
489- self .response_code = 304
490- self .header ()
491- except SendStaticFile , file :
492- try :
493- self .serve_static_file (str (file ))
494- except NotModified :
495- # send the 304 response
496- self .response_code = 304
497- self .header ()
498493 except Unauthorised , message :
499494 # users may always see the front page
500495 self .response_code = 403
501496 self .classname = self .nodeid = None
502497 self .template = ''
503498 self .error_message .append (message )
504499 self .write_html (self .renderContext ())
500+ except NotModified :
501+ # send the 304 response
502+ self .response_code = 304
503+ self .header ()
505504 except NotFound , e :
506505 self .response_code = 404
507506 self .template = '404'
0 commit comments