##// END OF EJS Templates
routing: skip advanced delete for repo creating so we can remove stuck repositories.
marcink -
r2913:3474cae9 default
parent child Browse files
Show More
@@ -470,7 +470,14 b' class RepoRoutePredicate(object):'
470
470
471 by_name_match = repo_model.get_by_repo_name(repo_name, cache=False)
471 by_name_match = repo_model.get_by_repo_name(repo_name, cache=False)
472
472
473 def redirect_if_creating(db_repo):
473 def redirect_if_creating(route_info, db_repo):
474 skip_views = ['edit_repo_advanced_delete']
475 route = route_info['route']
476 # we should skip delete view so we can actually "remove" repositories
477 # if they get stuck in creating state.
478 if route.name in skip_views:
479 return
480
474 if db_repo.repo_state in [repo.Repository.STATE_PENDING]:
481 if db_repo.repo_state in [repo.Repository.STATE_PENDING]:
475 repo_creating_url = request.route_path(
482 repo_creating_url = request.route_path(
476 'repo_creating', repo_name=db_repo.repo_name)
483 'repo_creating', repo_name=db_repo.repo_name)
@@ -479,13 +486,13 b' class RepoRoutePredicate(object):'
479 if by_name_match:
486 if by_name_match:
480 # register this as request object we can re-use later
487 # register this as request object we can re-use later
481 request.db_repo = by_name_match
488 request.db_repo = by_name_match
482 redirect_if_creating(by_name_match)
489 redirect_if_creating(info, by_name_match)
483 return True
490 return True
484
491
485 by_id_match = repo_model.get_repo_by_id(repo_name)
492 by_id_match = repo_model.get_repo_by_id(repo_name)
486 if by_id_match:
493 if by_id_match:
487 request.db_repo = by_id_match
494 request.db_repo = by_id_match
488 redirect_if_creating(by_id_match)
495 redirect_if_creating(info, by_id_match)
489 return True
496 return True
490
497
491 return False
498 return False
General Comments 0
You need to be logged in to leave comments. Login now