def delete_project(project): if project.swarm_project: delete_swarm_project(project.swarm_project) if settings.PERFORCE_INTEGRATION_ENABLED: with P4ConnectionAsServiceUser() as p4: try: remove_p4_protection_line(p4, construct_protection_line(project.p4_path, project.p4_access_group_name)) except P4Exception, e: logger.error(traceback.format_exc()) for e in p4.errors(): logger.error(e) # Delete group in P4 # TODO: perhaps check for group existence before deleting? That will allow for ignoring a narrower range of exceptions if p4.group_exists(project.p4_access_group_name): try: p4.delete_group(project.p4_access_group_name) except P4Exception, e: logger.error(traceback.format_exc()) for e in p4.errors(): logger.error(e) try: delete_project_standard_files_in_p4(p4, project.p4_path) except P4Exception, e: logger.error(traceback.format_exc()) for e in p4.errors(): logger.error(e)
def delete_swarm_project(request, swarm_project_id): from swarm_project_actions import delete_swarm_project delete_swarm_project(SwarmProject.objects.get(id=swarm_project_id)) return projects(request)
def perform_destroy(self, instance): delete_swarm_project(instance)