def clean_slate(candidate): candidate.remove_problems() try: pset = candidate.path.hid.problems except: pset = ProblemSet() pset.host = candidate.path.hid pset.save() return pset
def clean_slate(candidate): candidate.remove_problems() try: pset = candidate.path.hid.problems except Exception, e: try: pset = ProblemSet() pset.host = candidate.path.hid pset.save() except: candidate.delete() return None