changeset 4755:244c9b103cff

error: be prepared for resp without status I have seen traces that shows that it can happen. Be prepared!
author Mads Kiilerich <madski@unity3d.com>
date Tue, 06 Jan 2015 00:54:36 +0100
parents 3246e58d1543
children e7812c9f6062
files kallithea/controllers/error.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/error.py	Tue Jan 06 00:54:36 2015 +0100
+++ b/kallithea/controllers/error.py	Tue Jan 06 00:54:36 2015 +0100
@@ -57,15 +57,15 @@
         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')