-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Delete runs #537
Delete runs #537
Changes from all commits
0860b10
dd5edfb
40ab588
7145a3d
18fdbcf
65d4fdb
86d4a87
cadc4f2
2133127
c81ebb0
c05d34f
faa7ae7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,8 @@ | |
from django.shortcuts import render | ||
from django.urls import reverse | ||
|
||
from protzilla.run import Run, get_available_run_names | ||
from protzilla.run import Run, get_available_run_names | ||
from protzilla.run_v2 import delete_run_folder | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. zur Klasse run vs. run_v2 sollten wir mal das alte BP fragen, was warum wo verwendet wird und wo dann unsere Änderungen am ehesten rein gehören (ich hätte aber auch am ehesten in run_v2 geschrieben) |
||
from protzilla.run_helper import log_messages | ||
from protzilla.stepfactory import StepFactory | ||
from protzilla.steps import Step | ||
|
@@ -229,6 +230,37 @@ def continue_(request: HttpRequest): | |
|
||
return HttpResponseRedirect(reverse("runs:detail", args=(run_name,))) | ||
|
||
def delete_(request: HttpRequest): | ||
""" | ||
Deletes an existing run. The user is redirected to the index page. | ||
|
||
:param request: the request object | ||
:type request: HttpRequest | ||
|
||
|
||
:return: the rendered details page of the run | ||
:rtype: HttpResponse | ||
""" | ||
run_name = request.POST["run_name"] | ||
if run_name in active_runs: | ||
del active_runs[run_name] | ||
|
||
try: | ||
delete_run_folder(run_name) | ||
except Exception as e: | ||
display_message( | ||
{ | ||
"level": 40, | ||
"msg": f"Couldn't delete the run '{run_name}' . Please check the permissions for this file or try running Protzilla as administrator.", | ||
"trace": format_trace(traceback.format_exception(e)), | ||
}, | ||
request, | ||
) | ||
traceback.print_exc() | ||
return HttpResponseRedirect(reverse("runs:index")) | ||
|
||
return HttpResponseRedirect(reverse("runs:index")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. voll schön geschrieben und an restliche File angepasst 💯 |
||
|
||
|
||
def next_(request, run_name): | ||
""" | ||
|
@@ -247,7 +279,7 @@ def next_(request, run_name): | |
run = active_runs[run_name] | ||
name = request.POST.get("name", None) | ||
if name: | ||
run.steps.name_current_step_instance(name) | ||
run.steps.name_current_step_instance(name) | ||
run.step_next() | ||
|
||
return HttpResponseRedirect(reverse("runs:detail", args=(run_name,))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warum ist dieser messages Teil gelöscht?