Пример #1
0
def adminProjectsCancelSprintDeletionPost(handler, projectid, id):
	handler.title('Undelete Sprint')
	requirePriv(handler, 'Admin')
	project = Project.load(int(projectid))
	if not project:
		ErrorBox.die('Invalid Project', "No project with ID <b>%d</b>" % int(projectid))
	sprint = Sprint.load(int(id))
	if not sprint:
		ErrorBox.die('Invalid Sprint', "No sprint with ID <b>%d</b>" % int(id))
	if sprint.project != project:
		# We really don't use the project at all, but it's the principle of the thing
		ErrorBox.die('Invalid Sprint', "Project/sprint mismatch")
	if 'deleted' not in sprint.flags:
		ErrorBox.die('Invalid Sprint', "Sprint is not deleted")

	sprint.flags.remove('deleted')
	sprint.save()
	Event.undeleteSprint(handler, sprint)

	delay(handler, SuccessBox("Deletion canceled for %s" % sprint.link(handler.session['user']), close = True))
	redirect("/admin/projects/%d" % project.id)