##// 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 return pylons_url(*args, **kw)
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 def url_replace(**qargs):
99 def url_replace(**qargs):
115 """ Returns the current request url while replacing query string args """
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 return None
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 def static_url(*args, **kwds):
2047 def static_url(*args, **kwds):
2057 """
2048 """
2058 Wrapper around pyramids `route_path` function. It is used to generate
2049 Wrapper around pyramids `route_path` function. It is used to generate
@@ -307,7 +307,7 b''
307 <div id="quick_login">
307 <div id="quick_login">
308 %if c.rhodecode_user.username == h.DEFAULT_USER:
308 %if c.rhodecode_user.username == h.DEFAULT_USER:
309 <h4>${_('Sign in to your account')}</h4>
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 <div class="form form-vertical">
311 <div class="form form-vertical">
312 <div class="fields">
312 <div class="fields">
313 <div class="field">
313 <div class="field">
@@ -60,11 +60,11 b''
60 </span>
60 </span>
61 <div class="pull-right">
61 <div class="pull-right">
62 <span id="parent_link">
62 <span id="parent_link">
63 <a href="#" title="${_('Parent Commit')}">${_('Parent')}</a>
63 <a href="#parentCommit" title="${_('Parent Commit')}">${_('Parent')}</a>
64 </span>
64 </span>
65 |
65 |
66 <span id="child_link">
66 <span id="child_link">
67 <a href="#" title="${_('Child Commit')}">${_('Child')}</a>
67 <a href="#childCommit" title="${_('Child Commit')}">${_('Child')}</a>
68 </span>
68 </span>
69 </div>
69 </div>
70 </div>
70 </div>
@@ -280,7 +280,7 b''
280 <div id="edit-container">
280 <div id="edit-container">
281 <div style="padding: 40px 0">
281 <div style="padding: 40px 0">
282 ${_('You need to be logged in to leave comments.')}
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 </div>
284 </div>
285 </div>
285 </div>
286 <div id="preview-container" class="clearfix" style="display: none;">
286 <div id="preview-container" class="clearfix" style="display: none;">
@@ -4,10 +4,10 b''
4 ## ${diff_block.diff_block_changeset_table(change)}
4 ## ${diff_block.diff_block_changeset_table(change)}
5 ##
5 ##
6 <%def name="changeset_message()">
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 </%def>
8 </%def>
9 <%def name="file_message()">
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 </%def>
11 </%def>
12
12
13 <%def name="diff_block_changeset_table(change)">
13 <%def name="diff_block_changeset_table(change)">
@@ -22,7 +22,7 b''
22 % if file_data["exceeds_limit"]:
22 % if file_data["exceeds_limit"]:
23 ${self.file_message()}
23 ${self.file_message()}
24 % else:
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 % endif
26 % endif
27 % endif
27 % endif
28 </div>
28 </div>
@@ -43,7 +43,7 b''
43 % if file_data["exceeds_limit"]:
43 % if file_data["exceeds_limit"]:
44 ${self.file_message()}
44 ${self.file_message()}
45 % else:
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 % endif
47 % endif
48 % endif
48 % endif
49 </div>
49 </div>
@@ -23,13 +23,7 b" return '%s_%s_%i' % (h.safeid(filename),"
23 %>
23 %>
24 </%def>
24 </%def>
25
25
26 <%def name="link_for(**kw)">
26
27 <%
28 new_args = request.GET.mixed()
29 new_args.update(kw)
30 return request.current_route_path(_query=new_args)
31 %>
32 </%def>
33
27
34 <%def name="render_diffset(diffset, commit=None,
28 <%def name="render_diffset(diffset, commit=None,
35
29
@@ -68,7 +62,7 b' return request.current_route_path(_query'
68 ${h.form('', class_='inline-form comment-form-login', method='get')}
62 ${h.form('', class_='inline-form comment-form-login', method='get')}
69 <div class="pull-left">
63 <div class="pull-left">
70 <div class="comment-help pull-right">
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 </div>
66 </div>
73 </div>
67 </div>
74 <div class="comment-button pull-right">
68 <div class="comment-button pull-right">
@@ -129,7 +123,7 b' collapse_all = len(diffset.files) > coll'
129 ${_('The requested commit is too big and content was truncated.')}
123 ${_('The requested commit is too big and content was truncated.')}
130
124
131 ${_ungettext('%(num)s file changed.', '%(num)s files changed.', diffset.changed_files) % {'num': diffset.changed_files}}
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 %else:
127 %else:
134 ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
128 ${_ungettext('%(num)s file changed: %(linesadd)s inserted, ''%(linesdel)s deleted',
135 '%(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}}
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 %if filediff.limited_diff:
174 %if filediff.limited_diff:
181 <tr class="cb-warning cb-collapser">
175 <tr class="cb-warning cb-collapser">
182 <td class="cb-text" ${c.diffmode == 'unified' and 'colspan=4' or 'colspan=6'}>
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 </td>
178 </td>
185 </tr>
179 </tr>
186 %else:
180 %else:
@@ -2,7 +2,7 b''
2 <div id="codeblock" class="browserblock">
2 <div id="codeblock" class="browserblock">
3 <div class="browser-header">
3 <div class="browser-header">
4 <div class="browser-nav">
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 <div class="info_box">
6 <div class="info_box">
7 ${h.hidden('refs_filter')}
7 ${h.hidden('refs_filter')}
8 <div class="info_box_elem previous">
8 <div class="info_box_elem previous">
General Comments 0
You need to be logged in to leave comments. Login now