routing: remove usage of url.current from pylons.
This commit is contained in:
parent
2f5d2e7d67
commit
26635ebc3e
7 changed files with 19 additions and 34 deletions
|
|
@ -96,21 +96,6 @@ def url(*args, **kw):
|
|||
return pylons_url(*args, **kw)
|
||||
|
||||
|
||||
def pylons_url_current(*args, **kw):
|
||||
"""
|
||||
This function overrides pylons.url.current() which returns the current
|
||||
path so that it will also work from a pyramid only context. This
|
||||
should be removed once port to pyramid is complete.
|
||||
"""
|
||||
from pylons import url as pylons_url
|
||||
if not args and not kw:
|
||||
request = get_current_request()
|
||||
return request.path
|
||||
return pylons_url.current(*args, **kw)
|
||||
|
||||
url.current = pylons_url_current
|
||||
|
||||
|
||||
def url_replace(**qargs):
|
||||
""" Returns the current request url while replacing query string args """
|
||||
|
||||
|
|
@ -2053,6 +2038,12 @@ def route_path_or_none(*args, **kwargs):
|
|||
return None
|
||||
|
||||
|
||||
def current_route_path(request, **kw):
|
||||
new_args = request.GET.mixed()
|
||||
new_args.update(kw)
|
||||
return request.current_route_path(_query=new_args)
|
||||
|
||||
|
||||
def static_url(*args, **kwds):
|
||||
"""
|
||||
Wrapper around pyramids `route_path` function. It is used to generate
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@
|
|||
<div id="quick_login">
|
||||
%if c.rhodecode_user.username == h.DEFAULT_USER:
|
||||
<h4>${_('Sign in to your account')}</h4>
|
||||
${h.form(h.route_path('login', _query={'came_from': h.url.current()}), needs_csrf_token=False)}
|
||||
${h.form(h.route_path('login', _query={'came_from': h.current_route_path(request)}), needs_csrf_token=False)}
|
||||
<div class="form form-vertical">
|
||||
<div class="fields">
|
||||
<div class="field">
|
||||
|
|
|
|||
|
|
@ -60,11 +60,11 @@
|
|||
</span>
|
||||
<div class="pull-right">
|
||||
<span id="parent_link">
|
||||
<a href="#" title="${_('Parent Commit')}">${_('Parent')}</a>
|
||||
<a href="#parentCommit" title="${_('Parent Commit')}">${_('Parent')}</a>
|
||||
</span>
|
||||
|
|
||||
<span id="child_link">
|
||||
<a href="#" title="${_('Child Commit')}">${_('Child')}</a>
|
||||
<a href="#childCommit" title="${_('Child Commit')}">${_('Child')}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -280,7 +280,7 @@
|
|||
<div id="edit-container">
|
||||
<div style="padding: 40px 0">
|
||||
${_('You need to be logged in to leave comments.')}
|
||||
<a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
|
||||
<a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div id="preview-container" class="clearfix" style="display: none;">
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@
|
|||
## ${diff_block.diff_block_changeset_table(change)}
|
||||
##
|
||||
<%def name="changeset_message()">
|
||||
<h5>${_('The requested commit is too big and content was truncated.')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
<h5>${_('The requested commit is too big and content was truncated.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
</%def>
|
||||
<%def name="file_message()">
|
||||
<h5>${_('The requested file is too big and its content is not shown.')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
<h5>${_('The requested file is too big and its content is not shown.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
</%def>
|
||||
|
||||
<%def name="diff_block_changeset_table(change)">
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
% if file_data["exceeds_limit"]:
|
||||
${self.file_message()}
|
||||
% else:
|
||||
<h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
<h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
% endif
|
||||
% endif
|
||||
</div>
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
% if file_data["exceeds_limit"]:
|
||||
${self.file_message()}
|
||||
% else:
|
||||
<h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.url.current(fulldiff=1, **request.GET.mixed())}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
<h5>${_('Diff was truncated. File content available only in full diff.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a></h5>
|
||||
% endif
|
||||
% endif
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -23,13 +23,7 @@ return '%s_%s_%i' % (h.safeid(filename), type, line)
|
|||
%>
|
||||
</%def>
|
||||
|
||||
<%def name="link_for(**kw)">
|
||||
<%
|
||||
new_args = request.GET.mixed()
|
||||
new_args.update(kw)
|
||||
return request.current_route_path(_query=new_args)
|
||||
%>
|
||||
</%def>
|
||||
|
||||
|
||||
<%def name="render_diffset(diffset, commit=None,
|
||||
|
||||
|
|
@ -68,7 +62,7 @@ return request.current_route_path(_query=new_args)
|
|||
${h.form('', class_='inline-form comment-form-login', method='get')}
|
||||
<div class="pull-left">
|
||||
<div class="comment-help pull-right">
|
||||
${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
|
||||
${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="comment-button pull-right">
|
||||
|
|
@ -129,7 +123,7 @@ collapse_all = len(diffset.files) > collapse_when_files_over
|
|||
${_('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>
|
||||
<a href="${h.current_route_path(request, 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}}
|
||||
|
|
@ -180,7 +174,7 @@ collapse_all = len(diffset.files) > collapse_when_files_over
|
|||
%if filediff.limited_diff:
|
||||
<tr class="cb-warning cb-collapser">
|
||||
<td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
|
||||
${_('The requested commit is too big and content was truncated.')} <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
|
||||
${_('The requested commit is too big and content was truncated.')} <a href="${h.current_route_path(request, fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
|
||||
</td>
|
||||
</tr>
|
||||
%else:
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<div id="codeblock" class="browserblock">
|
||||
<div class="browser-header">
|
||||
<div class="browser-nav">
|
||||
${h.form(h.url.current(), method='GET', id='at_rev_form')}
|
||||
${h.form(h.current_route_path(request), method='GET', id='at_rev_form')}
|
||||
<div class="info_box">
|
||||
${h.hidden('refs_filter')}
|
||||
<div class="info_box_elem previous">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue