##// END OF EJS Templates
json: fixed calls to json after orjson implementation
super-admin -
r4974:37813a48 default
parent child Browse files
Show More
@@ -40,7 +40,7 b' from rhodecode.lib.exceptions import ('
40 UserCreationError, UserOwnsReposException, UserOwnsRepoGroupsException,
40 UserCreationError, UserOwnsReposException, UserOwnsRepoGroupsException,
41 UserOwnsUserGroupsException, UserOwnsPullRequestsException,
41 UserOwnsUserGroupsException, UserOwnsPullRequestsException,
42 UserOwnsArtifactsException, DefaultUserException)
42 UserOwnsArtifactsException, DefaultUserException)
43 from rhodecode.lib.ext_json import json
43 from rhodecode.lib import ext_json
44 from rhodecode.lib.auth import (
44 from rhodecode.lib.auth import (
45 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
45 LoginRequired, HasPermissionAllDecorator, CSRFRequired)
46 from rhodecode.lib import helpers as h
46 from rhodecode.lib import helpers as h
@@ -1169,7 +1169,7 b' class UsersView(UserAppView):'
1169
1169
1170 groups = [UserGroupModel.get_user_groups_as_dict(group.users_group)
1170 groups = [UserGroupModel.get_user_groups_as_dict(group.users_group)
1171 for group in c.user.group_member]
1171 for group in c.user.group_member]
1172 c.groups = json.dumps(groups)
1172 c.groups = ext_json.str_json(groups)
1173 c.active = 'groups'
1173 c.active = 'groups'
1174
1174
1175 return self._get_template_context(c)
1175 return self._get_template_context(c)
@@ -1258,9 +1258,8 b' class UsersView(UserAppView):'
1258 for entry in user_log:
1258 for entry in user_log:
1259 audit_log_data[entry.user_log_id] = entry.get_dict()
1259 audit_log_data[entry.user_log_id] = entry.get_dict()
1260
1260
1261 response = Response(json.dumps(audit_log_data, indent=4))
1261 response = Response(ext_json.formatted_str_json(audit_log_data))
1262 response.content_disposition = str(
1262 response.content_disposition = f'attachment; filename=user_{c.user.user_id}_audit_logs.json'
1263 'attachment; filename=%s' % 'user_{}_audit_logs.json'.format(c.user.user_id))
1264 response.content_type = 'application/json'
1263 response.content_type = 'application/json'
1265
1264
1266 return response
1265 return response
@@ -25,6 +25,7 b' from pyramid.settings import asbool'
25
25
26 from rhodecode.apps._base import ADMIN_PREFIX
26 from rhodecode.apps._base import ADMIN_PREFIX
27 from rhodecode.lib.ext_json import json
27 from rhodecode.lib.ext_json import json
28 from rhodecode.lib.str_utils import safe_str
28
29
29
30
30 def url_gen(request):
31 def url_gen(request):
@@ -38,7 +39,7 b' def url_gen(request):'
38 'longpoll': longpoll_url or proxy_url,
39 'longpoll': longpoll_url or proxy_url,
39 'ws': ws_url or proxy_url.replace('http', 'ws')
40 'ws': ws_url or proxy_url.replace('http', 'ws')
40 }
41 }
41 return json.dumps(urls)
42 return safe_str(json.dumps(urls))
42
43
43
44
44 PLUGIN_DEFINITION = {
45 PLUGIN_DEFINITION = {
@@ -30,7 +30,7 b' from pyramid.renderers import render'
30 from pyramid.response import Response
30 from pyramid.response import Response
31
31
32 from rhodecode.apps._base import BaseAppView
32 from rhodecode.apps._base import BaseAppView
33 from rhodecode.lib import helpers as h
33 from rhodecode.lib import helpers as h, ext_json
34 from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired
34 from rhodecode.lib.auth import LoginRequired, NotAnonymous, CSRFRequired
35 from rhodecode.lib.utils2 import time_to_datetime
35 from rhodecode.lib.utils2 import time_to_datetime
36 from rhodecode.lib.ext_json import json
36 from rhodecode.lib.ext_json import json
@@ -124,7 +124,7 b' class GistView(BaseAppView):'
124 'expires': _render('gist_expires', gist.gist_expires),
124 'expires': _render('gist_expires', gist.gist_expires),
125 'description': _render('gist_description', gist.gist_description)
125 'description': _render('gist_description', gist.gist_description)
126 })
126 })
127 c.data = json.dumps(data)
127 c.data = ext_json.str_json(data)
128
128
129 return self._get_template_context(c)
129 return self._get_template_context(c)
130
130
@@ -31,7 +31,7 b' from rhodecode.apps._base import BaseApp'
31 from rhodecode import forms
31 from rhodecode import forms
32 from rhodecode.lib import helpers as h
32 from rhodecode.lib import helpers as h
33 from rhodecode.lib import audit_logger
33 from rhodecode.lib import audit_logger
34 from rhodecode.lib.ext_json import json
34 from rhodecode.lib import ext_json
35 from rhodecode.lib.auth import (
35 from rhodecode.lib.auth import (
36 LoginRequired, NotAnonymous, CSRFRequired,
36 LoginRequired, NotAnonymous, CSRFRequired,
37 HasRepoPermissionAny, HasRepoGroupPermissionAny, AuthUser)
37 HasRepoPermissionAny, HasRepoGroupPermissionAny, AuthUser)
@@ -457,7 +457,7 b' class MyAccountView(BaseAppView, DataGri'
457 repos_data.append(row)
457 repos_data.append(row)
458
458
459 # json used to render the grid
459 # json used to render the grid
460 return json.dumps(repos_data)
460 return ext_json.str_json(repos_data)
461
461
462 @LoginRequired()
462 @LoginRequired()
463 @NotAnonymous()
463 @NotAnonymous()
@@ -779,5 +779,5 b' class MyAccountView(BaseAppView, DataGri'
779 c.active = 'user_group_membership'
779 c.active = 'user_group_membership'
780 groups = [UserGroupModel.get_user_groups_as_dict(group.users_group)
780 groups = [UserGroupModel.get_user_groups_as_dict(group.users_group)
781 for group in self._rhodecode_db_user.group_member]
781 for group in self._rhodecode_db_user.group_member]
782 c.user_groups = json.dumps(groups)
782 c.user_groups = ext_json.str_json(groups)
783 return self._get_template_context(c)
783 return self._get_template_context(c)
@@ -21,9 +21,8 b' import logging'
21
21
22 from pyramid.httpexceptions import HTTPNotFound
22 from pyramid.httpexceptions import HTTPNotFound
23
23
24
25 from rhodecode.apps._base import BaseReferencesView
24 from rhodecode.apps._base import BaseReferencesView
26 from rhodecode.lib.ext_json import json
25 from rhodecode.lib import ext_json
27 from rhodecode.lib import helpers as h
26 from rhodecode.lib import helpers as h
28 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
27 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
29
28
@@ -47,5 +46,5 b' class RepoBookmarksView(BaseReferencesVi'
47 ref_items=ref_items, partials_template='bookmarks/bookmarks_data.mako')
46 ref_items=ref_items, partials_template='bookmarks/bookmarks_data.mako')
48
47
49 c.has_references = bool(data)
48 c.has_references = bool(data)
50 c.data = json.dumps(data)
49 c.data = ext_json.str_json(data)
51 return self._get_template_context(c)
50 return self._get_template_context(c)
@@ -22,7 +22,7 b' import logging'
22
22
23
23
24 from rhodecode.apps._base import BaseReferencesView
24 from rhodecode.apps._base import BaseReferencesView
25 from rhodecode.lib.ext_json import json
25 from rhodecode.lib import ext_json
26 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
26 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
27
27
28
28
@@ -42,5 +42,5 b' class RepoBranchesView(BaseReferencesVie'
42 ref_items=ref_items, partials_template='branches/branches_data.mako')
42 ref_items=ref_items, partials_template='branches/branches_data.mako')
43
43
44 c.has_references = bool(data)
44 c.has_references = bool(data)
45 c.data = json.dumps(data)
45 c.data = ext_json.str_json(data)
46 return self._get_template_context(c)
46 return self._get_template_context(c)
@@ -28,6 +28,7 b' from pyramid.response import Response'
28
28
29 from rhodecode.apps._base import RepoAppView
29 from rhodecode.apps._base import RepoAppView
30 import rhodecode.lib.helpers as h
30 import rhodecode.lib.helpers as h
31 from rhodecode.lib import ext_json
31 from rhodecode.lib.auth import (
32 from rhodecode.lib.auth import (
32 LoginRequired, HasRepoPermissionAnyDecorator)
33 LoginRequired, HasRepoPermissionAnyDecorator)
33
34
@@ -106,7 +107,7 b' class RepoChangelogView(RepoAppView):'
106
107
107 data = [[commit_id, vtx, edges, branch]
108 data = [[commit_id, vtx, edges, branch]
108 for commit_id, vtx, edges, branch in _colored(dag)]
109 for commit_id, vtx, edges, branch in _colored(dag)]
109 return json.dumps(data), json.dumps(current)
110 return ext_json.str_json(data), ext_json.str_json(current)
110
111
111 def _check_if_valid_branch(self, branch_name, repo_name, f_path):
112 def _check_if_valid_branch(self, branch_name, repo_name, f_path):
112 if branch_name not in self.rhodecode_vcs_repo.branches_all:
113 if branch_name not in self.rhodecode_vcs_repo.branches_all:
@@ -33,7 +33,7 b' from rhodecode.apps.file_store.exception'
33 from rhodecode.lib import diffs, codeblocks, channelstream
33 from rhodecode.lib import diffs, codeblocks, channelstream
34 from rhodecode.lib.auth import (
34 from rhodecode.lib.auth import (
35 LoginRequired, HasRepoPermissionAnyDecorator, NotAnonymous, CSRFRequired)
35 LoginRequired, HasRepoPermissionAnyDecorator, NotAnonymous, CSRFRequired)
36 from rhodecode.lib.ext_json import json
36 from rhodecode.lib import ext_json
37 from collections import OrderedDict
37 from collections import OrderedDict
38 from rhodecode.lib.diffs import (
38 from rhodecode.lib.diffs import (
39 cache_diff, load_cached_diff, diff_cache_exist, get_diff_context,
39 cache_diff, load_cached_diff, diff_cache_exist, get_diff_context,
@@ -218,7 +218,7 b' class RepoCommitsView(RepoAppView):'
218 member_reviewer['allowed_to_update'] = False
218 member_reviewer['allowed_to_update'] = False
219 c.commit_set_reviewers_data_json['reviewers'].append(member_reviewer)
219 c.commit_set_reviewers_data_json['reviewers'].append(member_reviewer)
220
220
221 c.commit_set_reviewers_data_json = json.dumps(c.commit_set_reviewers_data_json)
221 c.commit_set_reviewers_data_json = ext_json.str_json(c.commit_set_reviewers_data_json)
222
222
223 # NOTE(marcink): this uses the same voting logic as in pull-requests
223 # NOTE(marcink): this uses the same voting logic as in pull-requests
224 c.commit_review_status = ChangesetStatusModel().calculate_status(review_statuses)
224 c.commit_review_status = ChangesetStatusModel().calculate_status(review_statuses)
@@ -35,7 +35,7 b' from rhodecode.lib import helpers as h, '
35 from rhodecode.lib.base import vcs_operation_context
35 from rhodecode.lib.base import vcs_operation_context
36 from rhodecode.lib.diffs import load_cached_diff, cache_diff, diff_cache_exist
36 from rhodecode.lib.diffs import load_cached_diff, cache_diff, diff_cache_exist
37 from rhodecode.lib.exceptions import CommentVersionMismatch
37 from rhodecode.lib.exceptions import CommentVersionMismatch
38 from rhodecode.lib.ext_json import json
38 from rhodecode.lib import ext_json
39 from rhodecode.lib.auth import (
39 from rhodecode.lib.auth import (
40 LoginRequired, HasRepoPermissionAny, HasRepoPermissionAnyDecorator,
40 LoginRequired, HasRepoPermissionAny, HasRepoPermissionAnyDecorator,
41 NotAnonymous, CSRFRequired)
41 NotAnonymous, CSRFRequired)
@@ -468,7 +468,7 b' class RepoPullRequestsView(RepoAppView, '
468 c.observers_count = pull_request.observers_count
468 c.observers_count = pull_request.observers_count
469
469
470 # reviewers and statuses
470 # reviewers and statuses
471 c.pull_request_default_reviewers_data_json = json.dumps(pull_request.reviewer_data)
471 c.pull_request_default_reviewers_data_json = ext_json.str_json(pull_request.reviewer_data)
472 c.pull_request_set_reviewers_data_json = collections.OrderedDict({'reviewers': []})
472 c.pull_request_set_reviewers_data_json = collections.OrderedDict({'reviewers': []})
473 c.pull_request_set_observers_data_json = collections.OrderedDict({'observers': []})
473 c.pull_request_set_observers_data_json = collections.OrderedDict({'observers': []})
474
474
@@ -485,7 +485,7 b' class RepoPullRequestsView(RepoAppView, '
485 member_reviewer['allowed_to_update'] = c.allowed_to_update
485 member_reviewer['allowed_to_update'] = c.allowed_to_update
486 c.pull_request_set_reviewers_data_json['reviewers'].append(member_reviewer)
486 c.pull_request_set_reviewers_data_json['reviewers'].append(member_reviewer)
487
487
488 c.pull_request_set_reviewers_data_json = json.dumps(c.pull_request_set_reviewers_data_json)
488 c.pull_request_set_reviewers_data_json = ext_json.str_json(c.pull_request_set_reviewers_data_json)
489
489
490 for observer_obj, member in pull_request_at_ver.observers():
490 for observer_obj, member in pull_request_at_ver.observers():
491 member_observer = h.reviewer_as_json(
491 member_observer = h.reviewer_as_json(
@@ -496,7 +496,7 b' class RepoPullRequestsView(RepoAppView, '
496 member_observer['allowed_to_update'] = c.allowed_to_update
496 member_observer['allowed_to_update'] = c.allowed_to_update
497 c.pull_request_set_observers_data_json['observers'].append(member_observer)
497 c.pull_request_set_observers_data_json['observers'].append(member_observer)
498
498
499 c.pull_request_set_observers_data_json = json.dumps(c.pull_request_set_observers_data_json)
499 c.pull_request_set_observers_data_json = ext_json.str_json(c.pull_request_set_observers_data_json)
500
500
501 general_comments, inline_comments = \
501 general_comments, inline_comments = \
502 self.register_comments_vars(c, pull_request_latest, versions)
502 self.register_comments_vars(c, pull_request_latest, versions)
@@ -889,9 +889,9 b' class RepoPullRequestsView(RepoAppView, '
889
889
890 c.default_repo_data = {
890 c.default_repo_data = {
891 'source_repo_name': source_repo.repo_name,
891 'source_repo_name': source_repo.repo_name,
892 'source_refs_json': json.dumps(source_repo_data),
892 'source_refs_json': ext_json.str_json(source_repo_data),
893 'target_repo_name': default_target_repo.repo_name,
893 'target_repo_name': default_target_repo.repo_name,
894 'target_refs_json': json.dumps(target_repo_data),
894 'target_refs_json': ext_json.str_json(target_repo_data),
895 }
895 }
896 c.default_source_ref = selected_source_ref
896 c.default_source_ref = selected_source_ref
897
897
@@ -21,7 +21,7 b''
21 import logging
21 import logging
22
22
23 from rhodecode.apps._base import BaseReferencesView
23 from rhodecode.apps._base import BaseReferencesView
24 from rhodecode.lib.ext_json import json
24 from rhodecode.lib import ext_json
25 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
25 from rhodecode.lib.auth import (LoginRequired, HasRepoPermissionAnyDecorator)
26
26
27 log = logging.getLogger(__name__)
27 log = logging.getLogger(__name__)
@@ -40,5 +40,5 b' class RepoTagsView(BaseReferencesView):'
40 ref_items=ref_items, partials_template='tags/tags_data.mako')
40 ref_items=ref_items, partials_template='tags/tags_data.mako')
41
41
42 c.has_references = bool(data)
42 c.has_references = bool(data)
43 c.data = json.dumps(data)
43 c.data = ext_json.str_json(data)
44 return self._get_template_context(c)
44 return self._get_template_context(c)
@@ -18,7 +18,7 b''
18 # RhodeCode Enterprise Edition, including its added features, Support services,
18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20
20
21 from rhodecode.lib.ext_json import json
21 from rhodecode.lib import ext_json
22
22
23
23
24 def pyramid_ext_json(info):
24 def pyramid_ext_json(info):
@@ -34,7 +34,8 b' def pyramid_ext_json(info):'
34 if ct == response.default_content_type:
34 if ct == response.default_content_type:
35 response.content_type = 'application/json'
35 response.content_type = 'application/json'
36 indent = getattr(request, 'ext_json_indent', None)
36 indent = getattr(request, 'ext_json_indent', None)
37
37 if indent:
38 return json.dumps(value, indent=indent)
38 return ext_json.formatted_json(value)
39 return ext_json.json.dumps(value)
39
40
40 return _render
41 return _render
@@ -78,7 +78,9 b' from webhelpers2.number import format_by'
78
78
79 from rhodecode.lib.action_parser import action_parser
79 from rhodecode.lib.action_parser import action_parser
80 from rhodecode.lib.pagination import Page, RepoPage, SqlPage
80 from rhodecode.lib.pagination import Page, RepoPage, SqlPage
81 from rhodecode.lib import ext_json
81 from rhodecode.lib.ext_json import json
82 from rhodecode.lib.ext_json import json
83 from rhodecode.lib.str_utils import safe_bytes
82 from rhodecode.lib.utils import repo_name_slug, get_custom_lexer
84 from rhodecode.lib.utils import repo_name_slug, get_custom_lexer
83 from rhodecode.lib.utils2 import (
85 from rhodecode.lib.utils2 import (
84 str2bool, safe_unicode, safe_str,
86 str2bool, safe_unicode, safe_str,
@@ -135,6 +137,14 b' def html_escape(text, html_escape_table='
135 return text.translate(html_escape_table)
137 return text.translate(html_escape_table)
136
138
137
139
140 def str_json(*args, **kwargs):
141 return ext_json.str_json(*args, **kwargs)
142
143
144 def formatted_str_json(*args, **kwargs):
145 return ext_json.formatted_str_json(*args, **kwargs)
146
147
138 def chop_at_smart(s, sub, inclusive=False, suffix_if_chopped=None):
148 def chop_at_smart(s, sub, inclusive=False, suffix_if_chopped=None):
139 """
149 """
140 Truncate string ``s`` at the first occurrence of ``sub``.
150 Truncate string ``s`` at the first occurrence of ``sub``.
@@ -346,7 +356,7 b' def files_url_data(request):'
346 if 'commit_id' not in matchdict:
356 if 'commit_id' not in matchdict:
347 matchdict['commit_id'] = 'tip'
357 matchdict['commit_id'] = 'tip'
348
358
349 return json.dumps(matchdict)
359 return ext_json.str_json(matchdict)
350
360
351
361
352 def repo_files_by_ref_url(db_repo_name, db_repo_type, f_path, ref_name, commit_id, query=None, ):
362 def repo_files_by_ref_url(db_repo_name, db_repo_type, f_path, ref_name, commit_id, query=None, ):
@@ -768,7 +778,7 b' class Flash(object):'
768 'subdata': message.sub_data
778 'subdata': message.sub_data
769 }
779 }
770 })
780 })
771 return json.dumps(payloads)
781 return safe_str(json.dumps(payloads))
772
782
773 def __call__(self, message, category=None, ignore_duplicate=True,
783 def __call__(self, message, category=None, ignore_duplicate=True,
774 session=None, request=None):
784 session=None, request=None):
@@ -251,7 +251,7 b' def write_usage_data(event):'
251 )
251 )
252
252
253 with open(dest_file, 'wb') as f:
253 with open(dest_file, 'wb') as f:
254 f.write(ext_json.json.dumps(metadata, indent=2, sort_keys=True))
254 f.write(ext_json.formatted_json(metadata))
255
255
256 try:
256 try:
257 log.debug('Writing usage file at: %s', usage_metadata_destination)
257 log.debug('Writing usage file at: %s', usage_metadata_destination)
@@ -83,7 +83,7 b''
83 <td class="td-journalaction">
83 <td class="td-journalaction">
84 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_2:
84 % if c.audit_log_entry.version == c.audit_log_entry.VERSION_2:
85 <div>
85 <div>
86 <pre>${h.json.dumps(c.audit_log_entry.action_data, indent=4, sort_keys=True)}</pre>
86 <pre>${h.formatted_str_json(c.audit_log_entry.action_data)}</pre>
87 </div>
87 </div>
88 % else:
88 % else:
89 <pre title="${_('data not available for v1 entries type')}">-</pre>
89 <pre title="${_('data not available for v1 entries type')}">-</pre>
@@ -41,7 +41,7 b''
41 % if l.version == l.VERSION_2:
41 % if l.version == l.VERSION_2:
42 <a href="#" onclick="$('#entry-'+${l.user_log_id}).toggle();return false">${_('toggle')}</a>
42 <a href="#" onclick="$('#entry-'+${l.user_log_id}).toggle();return false">${_('toggle')}</a>
43 <div id="entry-${l.user_log_id}" style="display: none">
43 <div id="entry-${l.user_log_id}" style="display: none">
44 <pre>${h.json.dumps(l.action_data, indent=4, sort_keys=True)}</pre>
44 <pre>${h.formatted_str_json(l.action_data)}</pre>
45 </div>
45 </div>
46 % else:
46 % else:
47 <pre title="${_('data not available for v1 entries type')}">-</pre>
47 <pre title="${_('data not available for v1 entries type')}">-</pre>
@@ -92,7 +92,7 b' examples = ['
92 % if loop.index == 0:
92 % if loop.index == 0:
93 <a href="#showMore" onclick="$('.it-examples').toggle(); return false">${_('show examples')}</a>
93 <a href="#showMore" onclick="$('.it-examples').toggle(); return false">${_('show examples')}</a>
94 % else:
94 % else:
95 <a href="#copyToInput" onclick="copyToInput(this, '${h.json.dumps(name)}', '${h.json.dumps(pat)}', '${h.json.dumps(url)}', '${h.json.dumps(pref)}'); return false">copy to input</a>
95 <a href="#copyToInput" onclick="copyToInput(this, '${h.str_json(name)}', '${h.str_json(pat)}', '${h.str_json(url)}', '${h.str_json(pref)}'); return false">copy to input</a>
96 % endif
96 % endif
97 </td>
97 </td>
98 </tr>
98 </tr>
@@ -80,7 +80,7 b" c.template_context['attachment_store'] ="
80 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
80 <script src="${h.asset('js/rhodecode/i18n/%s.js' % c.language, ver=c.rhodecode_version_hash)}"></script>
81 <script type="text/javascript">
81 <script type="text/javascript">
82 // register templateContext to pass template variables to JS
82 // register templateContext to pass template variables to JS
83 var templateContext = ${h.json.dumps(c.template_context)|n};
83 var templateContext = ${h.str_json(c.template_context)|n};
84
84
85 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
85 var APPLICATION_URL = "${h.route_path('home').rstrip('/')}";
86 var APPLICATION_PLUGINS = [];
86 var APPLICATION_PLUGINS = [];
@@ -109,7 +109,7 b''
109 % endif
109 % endif
110
110
111 <%
111 <%
112 data = h.json.dumps({
112 data = h.str_json({
113 'comment_id': comment_obj.comment_id,
113 'comment_id': comment_obj.comment_id,
114 'version_info': version_info,
114 'version_info': version_info,
115 'file_name': comment_obj.f_path,
115 'file_name': comment_obj.f_path,
@@ -37,12 +37,12 b''
37 line="${comment.line_no}"
37 line="${comment.line_no}"
38 data-comment-id="${comment.comment_id}"
38 data-comment-id="${comment.comment_id}"
39 data-comment-type="${comment.comment_type}"
39 data-comment-type="${comment.comment_type}"
40 data-comment-draft=${h.json.dumps(comment.draft)}
40 data-comment-draft=${h.str_json(comment.draft)}
41 data-comment-renderer="${comment.renderer}"
41 data-comment-renderer="${comment.renderer}"
42 data-comment-text="${comment.text | html_filters.base64,n}"
42 data-comment-text="${comment.text | html_filters.base64,n}"
43 data-comment-f-path="${comment.f_path}"
43 data-comment-f-path="${comment.f_path}"
44 data-comment-line-no="${comment.line_no}"
44 data-comment-line-no="${comment.line_no}"
45 data-comment-inline=${h.json.dumps(inline)}
45 data-comment-inline=${h.str_json(inline)}
46 style="${'display: none;' if outdated_at_ver else ''}">
46 style="${'display: none;' if outdated_at_ver else ''}">
47
47
48 <div class="meta">
48 <div class="meta">
@@ -81,7 +81,7 b''
81 % if comment.resolved_comment:
81 % if comment.resolved_comment:
82 <div class="tooltip" title="${_('This comment resolves TODO #{}').format(comment.resolved_comment.comment_id)}">
82 <div class="tooltip" title="${_('This comment resolves TODO #{}').format(comment.resolved_comment.comment_id)}">
83 fix
83 fix
84 <a href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'), 0, ${h.json.dumps(comment.resolved_comment.outdated)})">
84 <a href="#comment-${comment.resolved_comment.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${comment.resolved_comment.comment_id}'), 0, ${h.str_json(comment.resolved_comment.outdated)})">
85 <span style="text-decoration: line-through">#${comment.resolved_comment.comment_id}</span>
85 <span style="text-decoration: line-through">#${comment.resolved_comment.comment_id}</span>
86 </a>
86 </a>
87 </div>
87 </div>
@@ -547,7 +547,7 b''
547 <i class="icon-info-circled tooltip-hovercard"
547 <i class="icon-info-circled tooltip-hovercard"
548 data-hovercard-alt="ALT"
548 data-hovercard-alt="ALT"
549 data-hovercard-url="javascript:commentHelp('${c.visual.default_renderer.upper()}')"
549 data-hovercard-url="javascript:commentHelp('${c.visual.default_renderer.upper()}')"
550 data-comment-json-b64='${h.b64(h.json.dumps({}))}'></i>
550 data-comment-json-b64='${h.b64(h.str_json({}))}'></i>
551 </span>
551 </span>
552 </div>
552 </div>
553 </div>
553 </div>
@@ -1114,7 +1114,7 b' def get_comments_for(diff_type, comments'
1114 % for filediff in diffset.files:
1114 % for filediff in diffset.files:
1115 {id:"a_${h.FID(filediff.raw_id, filediff.patch['filename'])}",
1115 {id:"a_${h.FID(filediff.raw_id, filediff.patch['filename'])}",
1116 text:"${filediff.patch['filename']}",
1116 text:"${filediff.patch['filename']}",
1117 ops:${h.json.dumps(filediff.patch['stats'])|n}}${('' if loop.last else ',')}
1117 ops:${h.str_json(filediff.patch['stats'])|n}}${('' if loop.last else ',')}
1118 % endfor
1118 % endfor
1119 ]
1119 ]
1120 };
1120 };
@@ -22,7 +22,7 b''
22 <span style="white-space: pre-line">- ${pr_check_details['message']}</span>
22 <span style="white-space: pre-line">- ${pr_check_details['message']}</span>
23 % if pr_check_key == 'todo':
23 % if pr_check_key == 'todo':
24 % for co in pr_check_details['details']:
24 % for co in pr_check_details['details']:
25 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'), 0, ${h.json.dumps(co.outdated)})"> #${co.comment_id}</a>${'' if loop.last else ','}
25 <a class="permalink" href="#comment-${co.comment_id}" onclick="Rhodecode.comments.scrollToComment($('#comment-${co.comment_id}'), 0, ${h.str_json(co.outdated)})"> #${co.comment_id}</a>${'' if loop.last else ','}
26 % endfor
26 % endfor
27 % endif
27 % endif
28 </div>
28 </div>
@@ -21,7 +21,6 b''
21 import pytest
21 import pytest
22 import urllib.parse
22 import urllib.parse
23 import mock
23 import mock
24 import simplejson as json
25
24
26 from rhodecode.lib.vcs.backends.base import Config
25 from rhodecode.lib.vcs.backends.base import Config
27 from rhodecode.tests.lib.middleware import mock_scm_app
26 from rhodecode.tests.lib.middleware import mock_scm_app
General Comments 0
You need to be logged in to leave comments. Login now