comparison pylons_app/controllers/error.py @ 324:9a70fe918a81

fixed error controller __before__ behavior,
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 29 Jun 2010 13:13:09 +0200
parents 6ada8c223374
children 91ba8489119a
comparison
equal deleted inserted replaced
323:fc4027fe46bc 324:9a70fe918a81
19 related status codes are returned from the application. 19 related status codes are returned from the application.
20 20
21 This behaviour can be altered by changing the parameters to the 21 This behaviour can be altered by changing the parameters to the
22 ErrorDocuments middleware in your config/middleware.py file. 22 ErrorDocuments middleware in your config/middleware.py file.
23 """ 23 """
24 # def __before__(self): 24 def __before__(self):
25 # super(ErrorController, self).__before__() 25 pass#disable all base actions since we don't need them here
26 26
27 def document(self): 27 def document(self):
28 resp = request.environ.get('pylons.original_response') 28 resp = request.environ.get('pylons.original_response')
29 29
30 log.debug(resp.status) 30 log.debug('### %s ###', resp.status)
31 31
32 e = request.environ 32 e = request.environ
33 c.serv_p = r'%(protocol)s://%(host)s/' % { 33 c.serv_p = r'%(protocol)s://%(host)s/' % {
34 'protocol': e.get('wsgi.url_scheme'), 34 'protocol': e.get('wsgi.url_scheme'),
35 'host':e.get('HTTP_HOST'), 35 'host':e.get('HTTP_HOST'),
36 } 36 }
37 37
38
39 if resp.status_int == 404: 38 if resp.status_int == 404:
40 org_e = request.environ.get('pylons.original_request').environ 39 org_e = request.environ.get('pylons.original_request').environ
41 c.repo_name = repo_name = org_e['PATH_INFO'].split('/')[1] 40 c.repo_name = repo_name = org_e['PATH_INFO'].split('/')[1]
42 c.repo_name_cleaned = h.repo_name_slug(c.repo_name) 41 c.repo_name_cleaned = h.repo_name_slug(c.repo_name)
43 if check_repo(repo_name, g.base_path): 42 if check_repo(repo_name, g.base_path):