##// END OF EJS Templates
repo-view: handle empty repo or missing requirements in base view for repositories.
marcink -
r1714:01c11e23 default
parent child Browse files
Show More
@@ -25,6 +25,7 b' from pyramid.httpexceptions import HTTPF'
25
25
26 from rhodecode.lib import helpers as h
26 from rhodecode.lib import helpers as h
27 from rhodecode.lib.utils2 import StrictAttributeDict, safe_int
27 from rhodecode.lib.utils2 import StrictAttributeDict, safe_int
28 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
28 from rhodecode.model import repo
29 from rhodecode.model import repo
29 from rhodecode.model.db import User
30 from rhodecode.model.db import User
30 from rhodecode.model.scm import ScmModel
31 from rhodecode.model.scm import ScmModel
@@ -121,12 +122,25 b' class RepoAppView(BaseAppView):'
121 self.db_repo_name = self.db_repo.repo_name
122 self.db_repo_name = self.db_repo.repo_name
122 self.db_repo_pull_requests = ScmModel().get_pull_requests(self.db_repo)
123 self.db_repo_pull_requests = ScmModel().get_pull_requests(self.db_repo)
123
124
125 def _handle_missing_requirements(self, error):
126 log.error(
127 'Requirements are missing for repository %s: %s',
128 self.db_repo_name, error.message)
129
124 def _get_local_tmpl_context(self):
130 def _get_local_tmpl_context(self):
125 c = super(RepoAppView, self)._get_local_tmpl_context()
131 c = super(RepoAppView, self)._get_local_tmpl_context()
126 # register common vars for this type of view
132 # register common vars for this type of view
127 c.rhodecode_db_repo = self.db_repo
133 c.rhodecode_db_repo = self.db_repo
128 c.repo_name = self.db_repo_name
134 c.repo_name = self.db_repo_name
129 c.repository_pull_requests = self.db_repo_pull_requests
135 c.repository_pull_requests = self.db_repo_pull_requests
136
137 c.repository_requirements_missing = False
138 try:
139 self.rhodecode_vcs_repo = self.db_repo.scm_instance()
140 except RepositoryRequirementError as e:
141 c.repository_requirements_missing = True
142 self._handle_missing_requirements(e)
143
130 return c
144 return c
131
145
132
146
General Comments 0
You need to be logged in to leave comments. Login now