# HG changeset patch # User Marcin Kuzminski # Date 2018-07-26 19:55:03 # Node ID 3474cae928253d61a5474c4a6203736a8aedeafe # Parent 1ef2c7f6bc7809d5980b7f46096307025fd8a232 routing: skip advanced delete for repo creating so we can remove stuck repositories. diff --git a/rhodecode/apps/_base/__init__.py b/rhodecode/apps/_base/__init__.py --- a/rhodecode/apps/_base/__init__.py +++ b/rhodecode/apps/_base/__init__.py @@ -470,7 +470,14 @@ class RepoRoutePredicate(object): by_name_match = repo_model.get_by_repo_name(repo_name, cache=False) - def redirect_if_creating(db_repo): + def redirect_if_creating(route_info, db_repo): + skip_views = ['edit_repo_advanced_delete'] + route = route_info['route'] + # we should skip delete view so we can actually "remove" repositories + # if they get stuck in creating state. + if route.name in skip_views: + return + if db_repo.repo_state in [repo.Repository.STATE_PENDING]: repo_creating_url = request.route_path( 'repo_creating', repo_name=db_repo.repo_name) @@ -479,13 +486,13 @@ class RepoRoutePredicate(object): if by_name_match: # register this as request object we can re-use later request.db_repo = by_name_match - redirect_if_creating(by_name_match) + redirect_if_creating(info, by_name_match) return True by_id_match = repo_model.get_repo_by_id(repo_name) if by_id_match: request.db_repo = by_id_match - redirect_if_creating(by_id_match) + redirect_if_creating(info, by_id_match) return True return False