Mercurial > public > src > rhodecode
comparison pylons_app/controllers/error.py @ 260:6ada8c223374
made global funcion to clean repo names, and remove all special chars from the name.
Switched message slug into webhelpers function
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 06 Jun 2010 21:54:54 +0200 |
parents | 70f645fa97cc |
children | 9a70fe918a81 |
comparison
equal
deleted
inserted
replaced
259:dee1913f7f5a | 260:6ada8c223374 |
---|---|
6 from pylons.controllers.util import forward | 6 from pylons.controllers.util import forward |
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 from pylons_app.lib.filters import clean_repo | 11 import pylons_app.lib.helpers as h |
12 log = logging.getLogger(__name__) | 12 log = logging.getLogger(__name__) |
13 | 13 |
14 class ErrorController(BaseController): | 14 class ErrorController(BaseController): |
15 """ | 15 """ |
16 Generates error documents as and when they are required. | 16 Generates error documents as and when they are required. |
37 | 37 |
38 | 38 |
39 if resp.status_int == 404: | 39 if resp.status_int == 404: |
40 org_e = request.environ.get('pylons.original_request').environ | 40 org_e = request.environ.get('pylons.original_request').environ |
41 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.repo_name_cleaned = clean_repo(c.repo_name) | 42 c.repo_name_cleaned = h.repo_name_slug(c.repo_name) |
43 if check_repo(repo_name, g.base_path): | 43 if check_repo(repo_name, g.base_path): |
44 return render('/errors/error_404.html') | 44 return render('/errors/error_404.html') |
45 | 45 |
46 c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) | 46 c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) |
47 c.error_explanation = self.get_error_explanation(resp.status_int) | 47 c.error_explanation = self.get_error_explanation(resp.status_int) |