# HG changeset patch # User Mads Kiilerich # Date 2015-01-06 00:54:36 # Node ID 244c9b103cff934d3bdfad9d2517aa64bf2ac513 # Parent 3246e58d15433fa97a54984659a88f2a335e0c62 error: be prepared for resp without status I have seen traces that shows that it can happen. Be prepared! diff --git a/kallithea/controllers/error.py b/kallithea/controllers/error.py --- a/kallithea/controllers/error.py +++ b/kallithea/controllers/error.py @@ -57,15 +57,15 @@ class ErrorController(BaseController): resp = request.environ.get('pylons.original_response') c.site_name = config.get('title') - log.debug('### %s ###' % resp.status) + log.debug('### %s ###' % resp and resp.status) e = request.environ c.serv_p = r'%(protocol)s://%(host)s/' \ % {'protocol': e.get('wsgi.url_scheme'), 'host': e.get('HTTP_HOST'), } - c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) - c.error_explanation = self.get_error_explanation(resp.status_int) + c.error_message = resp and cgi.escape(request.GET.get('code', str(resp.status))) + c.error_explanation = resp and self.get_error_explanation(resp.status_int) return render('/errors/error_document.html')