Index: roundup/cgi/client.py =================================================================== --- roundup/cgi/client.py (revision 4199) +++ roundup/cgi/client.py (working copy) @@ -48,7 +48,7 @@ return '<%s>'%match.group(2) -error_message = """An error has occurred +error_message = ''"""An error has occurred

An error has occurred

A problem was encountered processing your request. The tracker maintainers have been notified of the problem.

@@ -431,41 +431,50 @@ self.determine_charset() self.determine_language() - # make sure we're identified (even anonymously) - self.determine_user() + try: + # make sure we're identified (even anonymously) + self.determine_user() - # figure out the context and desired content template - self.determine_context() + # figure out the context and desired content template + self.determine_context() - # possibly handle a form submit action (may change self.classname - # and self.template, and may also append error/ok_messages) - html = self.handle_action() + # possibly handle a form submit action (may change self.classname + # and self.template, and may also append error/ok_messages) + html = self.handle_action() - if html: - self.write_html(html) - return + if html: + self.write_html(html) + return - # now render the page - # we don't want clients caching our dynamic pages - self.additional_headers['Cache-Control'] = 'no-cache' -# Pragma: no-cache makes Mozilla and its ilk double-load all pages!! -# self.additional_headers['Pragma'] = 'no-cache' + # now render the page + # we don't want clients caching our dynamic pages + self.additional_headers['Cache-Control'] = 'no-cache' + # Pragma: no-cache makes Mozilla and its ilk + # double-load all pages!! + # self.additional_headers['Pragma'] = 'no-cache' - # pages with messages added expire right now - # simple views may be cached for a small amount of time - # TODO? make page expire time configurable - # always expire pages, as IE just doesn't seem to do the - # right thing here :( - date = time.time() - 1 - #if self.error_message or self.ok_message: - # date = time.time() - 1 - #else: - # date = time.time() + 5 - self.additional_headers['Expires'] = rfc822.formatdate(date) + # pages with messages added expire right now + # simple views may be cached for a small amount of time + # TODO? make page expire time configurable + # always expire pages, as IE just doesn't seem to do the + # right thing here :( + date = time.time() - 1 + #if self.error_message or self.ok_message: + # date = time.time() - 1 + #else: + # date = time.time() + 5 + self.additional_headers['Expires'] = rfc822.formatdate(date) - # render the content - try: + # render the content self.write_html(self.renderContext()) + except SendFile, designator: + # The call to serve_file may result in an Unauthorised + # exception or a NotModified exception. Those + # exceptions will be handled by the outermost set of + # exception handlers. + self.serve_file(designator) + except SendStaticFile, file: + self.serve_static_file(str(file)) except IOError: # IOErrors here are due to the client disconnecting before # recieving the reply. @@ -481,20 +490,6 @@ self.additional_headers['Location'] = str(url) self.response_code = 302 self.write_html('Redirecting to %s'%(url, url)) - except SendFile, designator: - try: - self.serve_file(designator) - except NotModified: - # send the 304 response - self.response_code = 304 - self.header() - except SendStaticFile, file: - try: - self.serve_static_file(str(file)) - except NotModified: - # send the 304 response - self.response_code = 304 - self.header() except Unauthorised, message: # users may always see the front page self.response_code = 403 @@ -502,6 +497,10 @@ self.template = '' self.error_message.append(message) self.write_html(self.renderContext()) + except NotModified: + # send the 304 response + self.response_code = 304 + self.header() except NotFound, e: self.response_code = 404 self.template = '404'