Show More
@@ -0,0 +1,35 b'' | |||||
|
1 | ## -*- coding: utf-8 -*- | |||
|
2 | <%! | |||
|
3 | from pylons_app.lib import filters | |||
|
4 | %> | |||
|
5 | <%inherit file="./../base/base.html"/> | |||
|
6 | ||||
|
7 | <%def name="title()"> | |||
|
8 | ${_('Repository not found')} | |||
|
9 | </%def> | |||
|
10 | ||||
|
11 | <%def name="breadcrumbs()"> | |||
|
12 | ${h.link_to(u'Home',h.url('hg_home'))} | |||
|
13 | / | |||
|
14 | ${h.link_to(u'Admin',h.url('admin_home'))} | |||
|
15 | </%def> | |||
|
16 | ||||
|
17 | <%def name="page_nav()"> | |||
|
18 | <li>${h.link_to(u'Home',h.url('hg_home'))}</li> | |||
|
19 | <li class="current">${_('Admin')}</li> | |||
|
20 | </%def> | |||
|
21 | <%def name="js()"> | |||
|
22 | ||||
|
23 | </%def> | |||
|
24 | <%def name="main()"> | |||
|
25 | ||||
|
26 | <h2 class="no-link no-border">Not Found</h2> | |||
|
27 | <p class="normal">The specified repository "${c.repo_name}" is unknown, sorry.</p> | |||
|
28 | <p class="normal"> | |||
|
29 | <a href="/_admin/add_repo/${c.repo_name|n,filters.clean_repo}">Create "${c.repo_name}" repository as ${c.repo_name|n,filters.clean_repo}</a> | |||
|
30 | ||||
|
31 | </p> | |||
|
32 | <p class="normal">Go back to the ${h.link_to(_('main repository list page'),h.url('hg_home'))}.</p> | |||
|
33 | <div class="page-footer"> | |||
|
34 | </div> | |||
|
35 | </%def> No newline at end of file |
@@ -1,7 +1,7 b'' | |||||
1 | import logging |
|
1 | import logging | |
2 | from paste.urlparser import PkgResourcesParser |
|
2 | from paste.urlparser import PkgResourcesParser | |
3 | import paste.fileapp |
|
3 | import paste.fileapp | |
4 |
from pylons import |
|
4 | from pylons import tmpl_context as c, app_globals as g, request, config | |
5 | from pylons.controllers.util import forward |
|
5 | from pylons.controllers.util import forward | |
6 | from pylons.i18n.translation import _ |
|
6 | from pylons.i18n.translation import _ | |
7 | from pylons_app.lib.base import BaseController, render |
|
7 | from pylons_app.lib.base import BaseController, render | |
@@ -22,17 +22,27 b' class ErrorController(BaseController):' | |||||
22 | """ |
|
22 | """ | |
23 | # |
|
23 | # | |
24 | def __before__(self): |
|
24 | def __before__(self): | |
25 | pass |
|
25 | c.repos_prefix = config['repos_name'] | |
26 |
|
26 | c.staticurl = g.statics | ||
|
27 | c.repo_name = request.environ['pylons.original_request']\ | |||
|
28 | .environ.get('PATH_INFO').split('/')[-1] | |||
|
29 | ||||
27 | def document(self): |
|
30 | def document(self): | |
28 |
|
||||
29 | resp = request.environ.get('pylons.original_response') |
|
31 | resp = request.environ.get('pylons.original_response') | |
30 | log.debug(resp.status) |
|
32 | log.debug(resp.status) | |
|
33 | ||||
|
34 | e = request.environ | |||
|
35 | c.serv_p = r'%(protocol)s://%(host)s/' % { | |||
|
36 | 'protocol': e.get('wsgi.url_scheme'), | |||
|
37 | 'host':e.get('HTTP_HOST'), | |||
|
38 | } | |||
|
39 | ||||
|
40 | if resp.status_int == 404: | |||
|
41 | return render('/errors/error_404.html') | |||
|
42 | ||||
31 | c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) |
|
43 | c.error_message = cgi.escape(request.GET.get('code', str(resp.status))) | |
32 | c.error_explanation = self.get_error_explanation(resp.status_int) |
|
44 | c.error_explanation = self.get_error_explanation(resp.status_int) | |
33 |
|
45 | |||
34 | c.serv_p = ''.join(['http://', request.environ.get('HTTP_HOST', '')]) |
|
|||
35 |
|
||||
36 | #redirect to when error with given seconds |
|
46 | #redirect to when error with given seconds | |
37 | c.redirect_time = 0 |
|
47 | c.redirect_time = 0 | |
38 | c.redirect_module = _('Home page')# name to what your going to be redirected |
|
48 | c.redirect_module = _('Home page')# name to what your going to be redirected |
@@ -1,5 +1,13 b'' | |||||
1 | from mercurial import util |
|
1 | from mercurial import util | |
2 | from mercurial.templatefilters import age as _age, person as _person |
|
2 | from mercurial.templatefilters import age as _age, person as _person | |
|
3 | from string import punctuation | |||
|
4 | ||||
|
5 | def clean_repo(repo_name): | |||
|
6 | for x in punctuation: | |||
|
7 | if x != '_': | |||
|
8 | repo_name = repo_name.replace(x, '') | |||
|
9 | repo_name = repo_name.lower().strip() | |||
|
10 | return repo_name.replace(' ', '_') | |||
3 |
|
11 | |||
4 | age = lambda x:_age(x) |
|
12 | age = lambda x:_age(x) | |
5 | capitalize = lambda x: x.capitalize() |
|
13 | capitalize = lambda x: x.capitalize() |
General Comments 0
You need to be logged in to leave comments.
Login now