# HG changeset patch # User Marcin Kuzminski # Date 2017-09-20 13:44:49 # Node ID d54201192f37d4ebaf7b628ddd9583ad33c435a4 # Parent c8a23404c3c096b6fda03d29074945dd15039525 routing: remove usage of url.current from pylons. 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 @@
%if c.rhodecode_user.username == h.DEFAULT_USER:

${_('Sign in to your account')}

- ${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)}
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 @@
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 @@
${_('You need to be logged in to leave comments.')} - ${_('Login now')} + ${_('Login now')}
@@ -43,7 +43,7 @@ % if file_data["exceeds_limit"]: ${self.file_message()} % else: -
${_('Diff was truncated. File content available only in full diff.')} ${_('Show full diff')}
+
${_('Diff was truncated. File content available only in full diff.')} ${_('Show full diff')}
% endif % endif
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 name="link_for(**kw)"> -<% -new_args = request.GET.mixed() -new_args.update(kw) -return request.current_route_path(_query=new_args) -%> - + <%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')}
- ${_('You need to be logged in to leave comments.')} ${_('Login now')} + ${_('You need to be logged in to leave comments.')} ${_('Login now')}
@@ -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}} - ${_('Show full diff')} + ${_('Show full diff')} %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: - ${_('The requested commit is too big and content was truncated.')} ${_('Show full diff')} + ${_('The requested commit is too big and content was truncated.')} ${_('Show full diff')} %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 @@
- ${h.form(h.url.current(), method='GET', id='at_rev_form')} + ${h.form(h.current_route_path(request), method='GET', id='at_rev_form')}
${h.hidden('refs_filter')}