##// END OF EJS Templates
Use safe_str on flash messages.
marcink -
r4077:0e102314 default
parent child Browse files
Show More
@@ -39,7 +39,7 b' from rhodecode.lib.compat import json'
39 39 from rhodecode.lib.graphmod import _colored, _dagwalker
40 40 from rhodecode.lib.vcs.exceptions import RepositoryError, ChangesetDoesNotExistError,\
41 41 ChangesetError, NodeDoesNotExistError, EmptyRepositoryError
42 from rhodecode.lib.utils2 import safe_int
42 from rhodecode.lib.utils2 import safe_int, safe_str
43 43
44 44
45 45 log = logging.getLogger(__name__)
@@ -91,7 +91,7 b' class ChangelogController(BaseRepoContro'
91 91
92 92 except RepositoryError, e:
93 93 log.error(traceback.format_exc())
94 h.flash(str(e), category='warning')
94 h.flash(safe_str(e), category='warning')
95 95 if not partial:
96 96 redirect(h.url('changelog_home', repo_name=repo.repo_name))
97 97 raise HTTPBadRequest()
@@ -158,7 +158,7 b' class ChangelogController(BaseRepoContro'
158 158 cs = self.__get_cs_or_redirect(revision, repo_name)
159 159 collection = cs.get_file_history(f_path)
160 160 except RepositoryError, e:
161 h.flash(str(e), category='warning')
161 h.flash(safe_str(e), category='warning')
162 162 redirect(h.url('changelog_home', repo_name=repo_name))
163 163 collection = list(reversed(collection))
164 164 else:
@@ -173,11 +173,11 b' class ChangelogController(BaseRepoContro'
173 173 c.comments = c.rhodecode_db_repo.get_comments(page_revisions)
174 174 c.statuses = c.rhodecode_db_repo.statuses(page_revisions)
175 175 except (EmptyRepositoryError), e:
176 h.flash(str(e), category='warning')
176 h.flash(safe_str(e), category='warning')
177 177 return redirect(url('summary_home', repo_name=c.repo_name))
178 178 except (RepositoryError, ChangesetDoesNotExistError, Exception), e:
179 179 log.error(traceback.format_exc())
180 h.flash(str(e), category='error')
180 h.flash(safe_str(e), category='error')
181 181 return redirect(url('changelog_home', repo_name=c.repo_name))
182 182
183 183 c.branch_name = branch_name
@@ -51,7 +51,7 b' from rhodecode.model.repo import RepoMod'
51 51 from rhodecode.lib.diffs import LimitedDiffContainer
52 52 from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError
53 53 from rhodecode.lib.vcs.backends.base import EmptyChangeset
54 from rhodecode.lib.utils2 import safe_unicode
54 from rhodecode.lib.utils2 import safe_unicode, safe_str
55 55
56 56 log = logging.getLogger(__name__)
57 57
@@ -201,7 +201,7 b' class ChangesetController(BaseRepoContro'
201 201
202 202 except (RepositoryError, ChangesetDoesNotExistError, Exception), e:
203 203 log.error(traceback.format_exc())
204 h.flash(str(e), category='error')
204 h.flash(safe_str(e), category='error')
205 205 raise HTTPNotFound()
206 206
207 207 c.changes = OrderedDict()
@@ -28,7 +28,7 b' import logging'
28 28 import traceback
29 29 import re
30 30
31 from webob.exc import HTTPNotFound
31 from webob.exc import HTTPNotFound, HTTPBadRequest
32 32 from pylons import request, response, session, tmpl_context as c, url
33 33 from pylons.controllers.util import abort, redirect
34 34 from pylons.i18n.translation import _
@@ -40,9 +40,8 b' from rhodecode.lib import helpers as h'
40 40 from rhodecode.lib.base import BaseRepoController, render
41 41 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
42 42 from rhodecode.lib import diffs
43
43 from rhodecode.lib.utils2 import safe_str
44 44 from rhodecode.model.db import Repository
45 from webob.exc import HTTPBadRequest
46 45 from rhodecode.lib.diffs import LimitedDiffContainer
47 46
48 47
@@ -91,7 +90,7 b' class CompareController(BaseRepoControll'
91 90
92 91 except RepositoryError, e:
93 92 log.error(traceback.format_exc())
94 h.flash(str(e), category='warning')
93 h.flash(safe_str(e), category='warning')
95 94 if not partial:
96 95 redirect(h.url('summary_home', repo_name=repo.repo_name))
97 96 raise HTTPBadRequest()
@@ -92,7 +92,7 b' class FilesController(BaseRepoController'
92 92 redirect(h.url('summary_home', repo_name=repo_name))
93 93
94 94 except RepositoryError, e: # including ChangesetDoesNotExistError
95 h.flash(str(e), category='error')
95 h.flash(safe_str(e), category='error')
96 96 raise HTTPNotFound()
97 97
98 98 def __get_filenode_or_redirect(self, repo_name, cs, path):
@@ -110,7 +110,7 b' class FilesController(BaseRepoController'
110 110 if file_node.is_dir():
111 111 raise RepositoryError('given path is a directory')
112 112 except RepositoryError, e:
113 h.flash(str(e), category='error')
113 h.flash(safe_str(e), category='error')
114 114 raise HTTPNotFound()
115 115
116 116 return file_node
@@ -175,7 +175,7 b' class FilesController(BaseRepoController'
175 175 else:
176 176 c.authors = c.file_history = []
177 177 except RepositoryError, e:
178 h.flash(str(e), category='error')
178 h.flash(safe_str(e), category='error')
179 179 raise HTTPNotFound()
180 180
181 181 if request.environ.get('HTTP_X_PARTIAL_XHR'):
General Comments 0
You need to be logged in to leave comments. Login now