##// END OF EJS Templates
hovercards: handle unknown commits on repo by returning 404 instead of 500 error.
marcink -
r4110:15b821fa default
parent child Browse files
Show More
@@ -22,6 +22,7 b' import re'
22 import logging
22 import logging
23 import collections
23 import collections
24
24
25 from pyramid.httpexceptions import HTTPNotFound
25 from pyramid.view import view_config
26 from pyramid.view import view_config
26
27
27 from rhodecode.apps._base import BaseAppView, RepoAppView
28 from rhodecode.apps._base import BaseAppView, RepoAppView
@@ -33,6 +34,7 b' from rhodecode.lib.codeblocks import fil'
33 from rhodecode.lib.index import searcher_from_config
34 from rhodecode.lib.index import searcher_from_config
34 from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int
35 from rhodecode.lib.utils2 import safe_unicode, str2bool, safe_int
35 from rhodecode.lib.ext_json import json
36 from rhodecode.lib.ext_json import json
37 from rhodecode.lib.vcs.exceptions import CommitDoesNotExistError
36 from rhodecode.lib.vcs.nodes import FileNode
38 from rhodecode.lib.vcs.nodes import FileNode
37 from rhodecode.model.db import (
39 from rhodecode.model.db import (
38 func, true, or_, case, in_filter_generator, Repository, RepoGroup, User, UserGroup, PullRequest)
40 func, true, or_, case, in_filter_generator, Repository, RepoGroup, User, UserGroup, PullRequest)
@@ -99,5 +101,9 b' class HoverCardsRepoView(RepoAppView):'
99 c = self.load_default_context()
101 c = self.load_default_context()
100 commit_id = self.request.matchdict['commit_id']
102 commit_id = self.request.matchdict['commit_id']
101 pre_load = ['author', 'branch', 'date', 'message']
103 pre_load = ['author', 'branch', 'date', 'message']
102 c.commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id, pre_load=pre_load)
104 try:
105 c.commit = self.rhodecode_vcs_repo.get_commit(commit_id=commit_id, pre_load=pre_load)
106 except CommitDoesNotExistError:
107 raise HTTPNotFound()
108
103 return self._get_template_context(c)
109 return self._get_template_context(c)
General Comments 0
You need to be logged in to leave comments. Login now