##// END OF EJS Templates
routing: remove usage of url.current from pylons.
marcink -
r2104:d5420119 default
parent child Browse files
Show More
@@ -96,21 +96,6 b' def url(*args, **kw):'
96 96 return pylons_url(*args, **kw)
97 97
98 98
99 def pylons_url_current(*args, **kw):
100 """
101 This function overrides pylons.url.current() which returns the current
102 path so that it will also work from a pyramid only context. This
103 should be removed once port to pyramid is complete.
104 """
105 from pylons import url as pylons_url
106 if not args and not kw:
107 request = get_current_request()
108 return request.path
109 return pylons_url.current(*args, **kw)
110
111 url.current = pylons_url_current
112
113
114 99 def url_replace(**qargs):
115 100 """ Returns the current request url while replacing query string args """
116 101
@@ -2053,6 +2038,12 b' def route_path_or_none(*args, **kwargs):'
2053 2038 return None
2054 2039
2055 2040
2041 def current_route_path(request, **kw):
2042 new_args = request.GET.mixed()
2043 new_args.update(kw)
2044 return request.current_route_path(_query=new_args)
2045
2046
2056 2047 def static_url(*args, **kwds):
2057 2048 """
2058 2049 Wrapper around pyramids `route_path` function. It is used to generate
@@ -307,7 +307,7 b''
307 307 <div id="quick_login">
308 308 %if c.rhodecode_user.username == h.DEFAULT_USER:
309 309 <h4>${_('Sign in to your account')}</h4>
310 ${h.form(h.route_path('login', _query={'came_from': h.url.current()}), needs_csrf_token=False)}
310 ${h.form(h.route_path('login', _query={'came_from': h.current_route_path(request)}), needs_csrf_token=False)}
311 311 <div class="form form-vertical">
312 312 <div class="fields">
313 313 <div class="field">
@@ -60,11 +60,11 b''
60 60 </span>
61 61 <div class="pull-right">
62 62 <span id="parent_link">
63 <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a>
63 <a href="#parentCommit" title="${_('Parent Commit')}">${_('Parent')}</a>
64 64 </span>
65 65 |
66 66 <span id="child_link">
67 <a href="#" title="${_('Child Commit')}">${_('Child')}</a>
67 <a href="#childCommit" title="${_('Child Commit')}">${_('Child')}</a>
68 68 </span>
69 69 </div>
70 70 </div>
@@ -280,7 +280,7 b''
280 280 <div id="edit-container">
281 281 <div style="padding: 40px 0">
282 282 ${_('You need to be logged in to leave comments.')}
283 <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
283 <a href="${h.route_path('login', _query={'came_from': h.current_route_path(request)})}">${_('Login now')}</a>
284 284 </div>
285 285 </div>
286 286 <div id="preview-container" class="clearfix" style="display: none;">
@@ -4,10 +4,10 b''
4 4 ## ${diff_block.diff_block_changeset_table(change)}
5 5 ##
6 6 <%def name="changeset_message()">
7 <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>
7 <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>
8 8 </%def>
9 9 <%def name="file_message()">
10 <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>
10 <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>
11 11 </%def>
12 12
13 13 <%def name="diff_block_changeset_table(change)">
@@ -22,7 +22,7 b''
22 22 % if file_data["exceeds_limit"]:
23 23 ${self.file_message()}
24 24 % else:
25 <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>
25 <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>
26 26 % endif
27 27 % endif
28 28 </div>
@@ -43,7 +43,7 b''
43 43 % if file_data["exceeds_limit"]:
44 44 ${self.file_message()}
45 45 % else:
46 <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>
46 <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>
47 47 % endif
48 48 % endif
49 49 </div>
@@ -23,13 +23,7 b" return '%s_%s_%i' % (h.safeid(filename),"
23 23 %>
24 24 </%def>
25 25
26 <%def name="link_for(**kw)">
27 <%
28 new_args = request.GET.mixed()
29 new_args.update(kw)
30 return request.current_route_path(_query=new_args)
31 %>
32 </%def>
26
33 27
34 28 <%def name="render_diffset(diffset, commit=None,
35 29
@@ -68,7 +62,7 b' return request.current_route_path(_query'
68 62 ${h.form('', class_='inline-form comment-form-login', method='get')}
69 63 <div class="pull-left">
70 64 <div class="comment-help pull-right">
71 ${_('You need to be logged in to leave comments.')} <a href="${h.route_path('login', _query={'came_from': h.url.current()})}">${_('Login now')}</a>
65 ${_('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>
72 66 </div>
73 67 </div>
74 68 <div class="comment-button pull-right">
@@ -129,7 +123,7 b' collapse_all = len(diffset.files) > coll'
129 123 ${_('The requested commit is too big and content was truncated.')}
130 124
131 125 ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
132 <a href="${link_for(fulldiff=1)}" onclick="return confirm('${_("Showing a big diff might take some time and resources, continue?")}')">${_('Show full diff')}</a>
126 <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>
133 127 %else:
134 128 ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
135 129 '%(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 b' collapse_all = len(diffset.files) > coll'
180 174 %if filediff.limited_diff:
181 175 <tr class="cb-warning cb-collapser">
182 176 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
183 ${_('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>
177 ${_('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>
184 178 </td>
185 179 </tr>
186 180 %else:
@@ -2,7 +2,7 b''
2 2 <div id="codeblock" class="browserblock">
3 3 <div class="browser-header">
4 4 <div class="browser-nav">
5 ${h.form(h.url.current(), method='GET', id='at_rev_form')}
5 ${h.form(h.current_route_path(request), method='GET', id='at_rev_form')}
6 6 <div class="info_box">
7 7 ${h.hidden('refs_filter')}
8 8 <div class="info_box_elem previous">
General Comments 0
You need to be logged in to leave comments. Login now