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