Mercurial > kallithea
comparison pylons_app/controllers/error.py @ 312:91ba8489119a
another small fix for error controller
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 29 Jun 2010 13:16:51 +0200 |
parents | 9a70fe918a81 |
children | 76f8bef61098 |
comparison
equal
deleted
inserted
replaced
311:9a70fe918a81 | 312:91ba8489119a |
---|---|
7 from pylons.i18n.translation import _ | 7 from pylons.i18n.translation import _ |
8 from pylons_app.lib.base import BaseController, render | 8 from pylons_app.lib.base import BaseController, render |
9 from pylons.middleware import media_path | 9 from pylons.middleware import media_path |
10 from pylons_app.lib.utils import check_repo | 10 from pylons_app.lib.utils import check_repo |
11 import pylons_app.lib.helpers as h | 11 import pylons_app.lib.helpers as h |
12 from pylons_app import __version__ | |
12 log = logging.getLogger(__name__) | 13 log = logging.getLogger(__name__) |
13 | 14 |
14 class ErrorController(BaseController): | 15 class ErrorController(BaseController): |
15 """ | 16 """ |
16 Generates error documents as and when they are required. | 17 Generates error documents as and when they are required. |
36 } | 37 } |
37 | 38 |
38 if resp.status_int == 404: | 39 if resp.status_int == 404: |
39 org_e = request.environ.get('pylons.original_request').environ | 40 org_e = request.environ.get('pylons.original_request').environ |
40 c.repo_name = repo_name = org_e['PATH_INFO'].split('/')[1] | 41 c.repo_name = repo_name = org_e['PATH_INFO'].split('/')[1] |
42 c.hg_app_version = __version__ | |
41 c.repo_name_cleaned = h.repo_name_slug(c.repo_name) | 43 c.repo_name_cleaned = h.repo_name_slug(c.repo_name) |
42 if check_repo(repo_name, g.base_path): | 44 if check_repo(repo_name, g.base_path): |
43 return render('/errors/error_404.html') | 45 return render('/errors/error_404.html') |
44 | 46 |
45 c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) | 47 c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) |