##// END OF EJS Templates
missing requirements: better handling of missing requirements for repositories....
marcink -
r2625:aff7e7b8 default
parent child Browse files
Show More
@@ -206,7 +206,7 b' class RepoAppView(BaseAppView):'
206 206 c.repository_pull_requests = self.db_repo_pull_requests
207 207 self.path_filter = PathFilter(None)
208 208
209 c.repository_requirements_missing = False
209 c.repository_requirements_missing = {}
210 210 try:
211 211 self.rhodecode_vcs_repo = self.db_repo.scm_instance()
212 212 if self.rhodecode_vcs_repo:
@@ -214,21 +214,30 b' class RepoAppView(BaseAppView):'
214 214 c.auth_user.username)
215 215 self.path_filter = PathFilter(path_perms)
216 216 except RepositoryRequirementError as e:
217 c.repository_requirements_missing = True
217 c.repository_requirements_missing = {'error': str(e)}
218 218 self._handle_missing_requirements(e)
219 219 self.rhodecode_vcs_repo = None
220 220
221 221 c.path_filter = self.path_filter # used by atom_feed_entry.mako
222 222
223 if (not c.repository_requirements_missing
224 and self.rhodecode_vcs_repo is None):
223 if self.rhodecode_vcs_repo is None:
225 224 # unable to fetch this repo as vcs instance, report back to user
226 225 h.flash(_(
227 226 "The repository `%(repo_name)s` cannot be loaded in filesystem. "
228 227 "Please check if it exist, or is not damaged.") %
229 228 {'repo_name': c.repo_name},
230 229 category='error', ignore_duplicate=True)
231 raise HTTPFound(h.route_path('home'))
230 if c.repository_requirements_missing:
231 route = self.request.matched_route.name
232 if route.startswith(('edit_repo', 'repo_summary')):
233 # allow summary and edit repo on missing requirements
234 return c
235
236 raise HTTPFound(
237 h.route_path('repo_summary', repo_name=self.db_repo_name))
238
239 else: # redirect if we don't show missing requirements
240 raise HTTPFound(h.route_path('home'))
232 241
233 242 return c
234 243
@@ -234,7 +234,8 b' class TestSummaryView(object):'
234 234 Repository, 'scm_instance', side_effect=RepositoryRequirementError)
235 235
236 236 with scm_patcher:
237 response = self.app.get(route_path('repo_summary', repo_name=repo_name))
237 response = self.app.get(
238 route_path('repo_summary', repo_name=repo_name))
238 239 assert_response = AssertResponse(response)
239 240 assert_response.element_contains(
240 241 '.main .alert-warning strong', 'Missing requirements')
@@ -22,6 +22,8 b''
22 22 - Mercurial largefiles
23 23 - Git LFS
24 24 </pre>
25 <br/>
26 Requirement error: ${c.repository_requirements_missing.get('error')}
25 27 </div>
26 28
27 29 </%def>
General Comments 0
You need to be logged in to leave comments. Login now