Changeset - 9a70fe918a81
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-06-29 13:13:09
marcin@python-works.com
fixed error controller __before__ behavior,
1 file changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
pylons_app/controllers/error.py
Show inline comments
 
@@ -18,27 +18,26 @@ class ErrorController(BaseController):
 
    The ErrorDocuments middleware forwards to ErrorController when error
 
    related status codes are returned from the application.
 

	
 
    This behaviour can be altered by changing the parameters to the
 
    ErrorDocuments middleware in your config/middleware.py file.
 
    """
 
#    def __before__(self):
 
#        super(ErrorController, self).__before__()
 
    def __before__(self):
 
        pass#disable all base actions since we don't need them here
 
        
 
    def document(self):
 
        resp = request.environ.get('pylons.original_response')
 
        
 
        log.debug(resp.status)
 
        log.debug('### %s ###', resp.status)
 

	
 
        e = request.environ
 
        c.serv_p = r'%(protocol)s://%(host)s/' % {
 
                                                'protocol': e.get('wsgi.url_scheme'),
 
                                                'host':e.get('HTTP_HOST'),
 
                                                }
 

	
 
                        
 
        if resp.status_int == 404:
 
            org_e = request.environ.get('pylons.original_request').environ
 
            c.repo_name = repo_name = org_e['PATH_INFO'].split('/')[1]
 
            c.repo_name_cleaned = h.repo_name_slug(c.repo_name)
 
            if check_repo(repo_name, g.base_path):
 
                return render('/errors/error_404.html')
0 comments (0 inline, 0 general)