# HG changeset patch # User Milka Kuzminski # Date 2020-12-04 15:11:40 # Node ID 749b9ba73154811f0755178f11d2c1086993e25c # Parent e8a65b0c94c8821720906ab058d969f2258b46ea commits/changelog: small fixes from found problems diff --git a/rhodecode/apps/repository/views/repo_changelog.py b/rhodecode/apps/repository/views/repo_changelog.py --- a/rhodecode/apps/repository/views/repo_changelog.py +++ b/rhodecode/apps/repository/views/repo_changelog.py @@ -216,6 +216,7 @@ class RepoChangelogView(RepoAppView): pre_load = self._get_preload_attrs() partial_xhr = self.request.environ.get('HTTP_X_PARTIAL_XHR') + try: if f_path: log.debug('generating changelog for path %s', f_path) @@ -258,8 +259,15 @@ class RepoChangelogView(RepoAppView): except (RepositoryError, CommitDoesNotExistError, Exception) as e: log.exception(safe_str(e)) h.flash(safe_str(h.escape(e)), category='error') - raise HTTPFound( - h.route_path('repo_commits', repo_name=self.db_repo_name)) + + if commit_id: + # from single commit page, we redirect to main commits + raise HTTPFound( + h.route_path('repo_commits', repo_name=self.db_repo_name)) + else: + # otherwise we redirect to summary + raise HTTPFound( + h.route_path('repo_summary', repo_name=self.db_repo_name)) if partial_xhr or self.request.environ.get('HTTP_X_PJAX'): # case when loading dynamic file history in file view diff --git a/rhodecode/apps/repository/views/repo_commits.py b/rhodecode/apps/repository/views/repo_commits.py --- a/rhodecode/apps/repository/views/repo_commits.py +++ b/rhodecode/apps/repository/views/repo_commits.py @@ -41,7 +41,7 @@ from rhodecode.lib.diffs import ( get_diff_whitespace_flag) from rhodecode.lib.exceptions import StatusChangeOnClosedPullRequestError, CommentVersionMismatch import rhodecode.lib.helpers as h -from rhodecode.lib.utils2 import safe_unicode, str2bool, StrictAttributeDict +from rhodecode.lib.utils2 import safe_unicode, str2bool, StrictAttributeDict, safe_str from rhodecode.lib.vcs.backends.base import EmptyCommit from rhodecode.lib.vcs.exceptions import ( RepositoryError, CommitDoesNotExistError) @@ -110,7 +110,7 @@ class RepoCommitsView(RepoAppView): if not c.commit_ranges: raise RepositoryError('The commit range returned an empty result') except CommitDoesNotExistError as e: - msg = _('No such commit exists. Org exception: `{}`').format(e) + msg = _('No such commit exists. Org exception: `{}`').format(safe_str(e)) h.flash(msg, category='error') raise HTTPNotFound() except Exception: