##// 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 c.repository_pull_requests = self.db_repo_pull_requests
206 c.repository_pull_requests = self.db_repo_pull_requests
207 self.path_filter = PathFilter(None)
207 self.path_filter = PathFilter(None)
208
208
209 c.repository_requirements_missing = False
209 c.repository_requirements_missing = {}
210 try:
210 try:
211 self.rhodecode_vcs_repo = self.db_repo.scm_instance()
211 self.rhodecode_vcs_repo = self.db_repo.scm_instance()
212 if self.rhodecode_vcs_repo:
212 if self.rhodecode_vcs_repo:
@@ -214,20 +214,29 b' class RepoAppView(BaseAppView):'
214 c.auth_user.username)
214 c.auth_user.username)
215 self.path_filter = PathFilter(path_perms)
215 self.path_filter = PathFilter(path_perms)
216 except RepositoryRequirementError as e:
216 except RepositoryRequirementError as e:
217 c.repository_requirements_missing = True
217 c.repository_requirements_missing = {'error': str(e)}
218 self._handle_missing_requirements(e)
218 self._handle_missing_requirements(e)
219 self.rhodecode_vcs_repo = None
219 self.rhodecode_vcs_repo = None
220
220
221 c.path_filter = self.path_filter # used by atom_feed_entry.mako
221 c.path_filter = self.path_filter # used by atom_feed_entry.mako
222
222
223 if (not c.repository_requirements_missing
223 if self.rhodecode_vcs_repo is None:
224 and self.rhodecode_vcs_repo is None):
225 # unable to fetch this repo as vcs instance, report back to user
224 # unable to fetch this repo as vcs instance, report back to user
226 h.flash(_(
225 h.flash(_(
227 "The repository `%(repo_name)s` cannot be loaded in filesystem. "
226 "The repository `%(repo_name)s` cannot be loaded in filesystem. "
228 "Please check if it exist, or is not damaged.") %
227 "Please check if it exist, or is not damaged.") %
229 {'repo_name': c.repo_name},
228 {'repo_name': c.repo_name},
230 category='error', ignore_duplicate=True)
229 category='error', ignore_duplicate=True)
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
231 raise HTTPFound(h.route_path('home'))
240 raise HTTPFound(h.route_path('home'))
232
241
233 return c
242 return c
@@ -234,7 +234,8 b' class TestSummaryView(object):'
234 Repository, 'scm_instance', side_effect=RepositoryRequirementError)
234 Repository, 'scm_instance', side_effect=RepositoryRequirementError)
235
235
236 with scm_patcher:
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 assert_response = AssertResponse(response)
239 assert_response = AssertResponse(response)
239 assert_response.element_contains(
240 assert_response.element_contains(
240 '.main .alert-warning strong', 'Missing requirements')
241 '.main .alert-warning strong', 'Missing requirements')
@@ -22,6 +22,8 b''
22 - Mercurial largefiles
22 - Mercurial largefiles
23 - Git LFS
23 - Git LFS
24 </pre>
24 </pre>
25 <br/>
26 Requirement error: ${c.repository_requirements_missing.get('error')}
25 </div>
27 </div>
26
28
27 </%def>
29 </%def>
General Comments 0
You need to be logged in to leave comments. Login now