diff --git a/rhodecode/lib/helpers.py b/rhodecode/lib/helpers.py --- a/rhodecode/lib/helpers.py +++ b/rhodecode/lib/helpers.py @@ -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 diff --git a/rhodecode/templates/base/base.mako b/rhodecode/templates/base/base.mako --- a/rhodecode/templates/base/base.mako +++ b/rhodecode/templates/base/base.mako @@ -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"> diff --git a/rhodecode/templates/changeset/changeset.mako b/rhodecode/templates/changeset/changeset.mako --- a/rhodecode/templates/changeset/changeset.mako +++ b/rhodecode/templates/changeset/changeset.mako @@ -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> diff --git a/rhodecode/templates/changeset/changeset_file_comment.mako b/rhodecode/templates/changeset/changeset_file_comment.mako --- a/rhodecode/templates/changeset/changeset_file_comment.mako +++ b/rhodecode/templates/changeset/changeset_file_comment.mako @@ -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;"> diff --git a/rhodecode/templates/changeset/diff_block.mako b/rhodecode/templates/changeset/diff_block.mako --- a/rhodecode/templates/changeset/diff_block.mako +++ b/rhodecode/templates/changeset/diff_block.mako @@ -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> diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako --- a/rhodecode/templates/codeblocks/diffs.mako +++ b/rhodecode/templates/codeblocks/diffs.mako @@ -23,13 +23,7 @@ return '%s_%s_%i' % (h.safeid(filename), %> </%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 ${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) > coll ${_('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) > coll %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: diff --git a/rhodecode/templates/files/files_browser.mako b/rhodecode/templates/files/files_browser.mako --- a/rhodecode/templates/files/files_browser.mako +++ b/rhodecode/templates/files/files_browser.mako @@ -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">