routing: removed more usage of pylons url() objects.

This commit is contained in:
Marcin Kuzminski 2017-09-20 15:21:03 +02:00
parent b9465d5203
commit 2f5d2e7d67
7 changed files with 21 additions and 16 deletions

View file

@ -52,6 +52,7 @@ class DebugStyleView(BaseAppView):
t_path = self.request.matchdict['t_path']
c = self.load_default_context()
c.active = os.path.splitext(t_path)[0]
c.came_from = ''
return render_to_response(
'debug_style/' + t_path, self._get_template_context(c),

View file

@ -38,7 +38,7 @@ and our server configuration are in sync.
then you can retrieve the url by simply calling the URL function:
`h.url('url_name')`
`h.route_path('url_name')`
The redirection must be first implemented in our servers before
you can see it working.

View file

@ -299,7 +299,7 @@ class CommentsModel(BaseModel):
'pullrequest_show',
repo_name=pr_target_repo.repo_name,
pull_request_id=pull_request_obj.pull_request_id,
anchor='comment-%s' % comment.comment_id)
_anchor='comment-%s' % comment.comment_id)
# set some variables for email notification
pr_target_repo_url = h.route_url(

View file

@ -34,6 +34,8 @@ function registerRCRoutes() {
pyroutes.register('ops_ping', '/_admin/ops/ping', []);
pyroutes.register('ops_error_test', '/_admin/ops/error', []);
pyroutes.register('ops_redirect_test', '/_admin/ops/redirect', []);
pyroutes.register('ops_ping_legacy', '/_admin/ping', []);
pyroutes.register('ops_error_test_legacy', '/_admin/error_test', []);
pyroutes.register('admin_home', '/_admin', []);
pyroutes.register('admin_audit_logs', '/_admin/audit_logs', []);
pyroutes.register('pull_requests_global_0', '/_admin/pull_requests/%(pull_request_id)s', ['pull_request_id']);

View file

@ -4,13 +4,14 @@
var CHANNELSTREAM_SETTINGS = {
'enabled': true,
'ws_location': '${request.registry.settings.get('channelstream.ws_url')}',
'webapp_location': '${h.url('/', qualified=True)[:-1]}'
'webapp_location': '${h.route_url('home').rstrip('/')}'
};
%else:
var CHANNELSTREAM_SETTINGS = {
'enabled':false,
'ws_location': '',
'webapp_location': ''};
'webapp_location': '${h.route_url('home').rstrip('/')}'
};
%endif
</script>

View file

@ -27,7 +27,7 @@ return '%s_%s_%i' % (h.safeid(filename), type, line)
<%
new_args = request.GET.mixed()
new_args.update(kw)
return h.url('', **new_args)
return request.current_route_path(_query=new_args)
%>
</%def>
@ -124,15 +124,16 @@ collapse_all = len(diffset.files) > collapse_when_files_over
<a class="tooltip revision" title="${h.tooltip(commit.message)}" href="${h.route_path('repo_commit',repo_name=c.repo_name,commit_id=commit.raw_id)}">${'r%s:%s' % (commit.revision,h.short_id(commit.raw_id))}</a> -
${h.age_component(commit.date)} -
%endif
%if diffset.limited_diff:
${_('The requested commit is too big and content was truncated.')}
${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
<a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
%else:
${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
'%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}}
%endif
%if diffset.limited_diff:
${_('The requested commit is too big and content was truncated.')}
${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
<a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
%else:
${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
'%(num)s files changed: %(linesadd)s inserted, %(linesdel)s deleted', diffset.changed_files) % {'num': diffset.changed_files, 'linesadd': diffset.lines_added, 'linesdel': diffset.lines_deleted}}
%endif
</h2>
</div>

View file

@ -27,7 +27,7 @@
<div id="quick_login">
<h4>${_('Sign in to your account')}</h4>
${h.form(h.url('login_home',came_from=h.url.current()), needs_csrf_token=False)}
${h.form(h.route_path('login'), needs_csrf_token=False)}
<div class="form form-vertical">
<div class="fields">
@ -43,7 +43,7 @@
<div class="field">
<div class="label">
<label for="password">${_('Password')}:</label>
<span class="forgot_password">${h.link_to(_('(Forgot password?)'),h.url('reset_password'))}</span>
<span class="forgot_password">${h.link_to(_('(Forgot password?)'),h.route_path('reset_password'))}</span>
</div>
<div class="input">
${h.password('password',class_='focus',tabindex=2)}
@ -53,7 +53,7 @@
<div class="buttons">
<div class="register">
%if h.HasPermissionAny('hg.admin', 'hg.register.auto_activate', 'hg.register.manual_activate')():
${h.link_to(_("Don't have an account ?"),h.url('register'))}
${h.link_to(_("Don't have an account ?"),h.route_path('register'))}
%endif
</div>
<div class="submit">