Changeset - 32de32f69461
[Not reviewed]
default
0 1 0
Mads Kiilerich - 11 years ago 2015-04-18 16:48:29
madski@unity3d.com
error: fix handling of errors without response

Broken by 6f9dae4d39d9.
1 file changed with 3 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/error.py
Show inline comments
 
@@ -58,24 +58,27 @@ class ErrorController(BaseController):
 
        c.site_name = config.get('title')
 

	
 
        log.debug('### %s ###' % (resp and resp.status or 'no response'))
 

	
 
        e = request.environ
 
        c.serv_p = r'%(protocol)s://%(host)s/' % {
 
            'protocol': e.get('wsgi.url_scheme'),
 
            'host': e.get('HTTP_HOST'), }
 
        if resp:
 
            c.error_message = cgi.escape(request.GET.get('code',
 
                                                         str(resp.status)))
 
            c.error_explanation = self.get_error_explanation(resp.status_int)
 
        else:
 
            c.error_message = _('No response')
 
            c.error_explanation = _('Unknown error')
 

	
 
        return render('/errors/error_document.html')
 

	
 
    def img(self, id):
 
        """Serve Pylons' stock images"""
 
        return self._serve_file(os.path.join(media_path, 'img', id))
 

	
 
    def style(self, id):
 
        """Serve Pylons' stock stylesheets"""
 
        return self._serve_file(os.path.join(media_path, 'style', id))
 

	
 
    def _serve_file(self, path):
0 comments (0 inline, 0 general)