Parsing error handling and MAC retrieval on new snapshots #27
|
@ -38,10 +38,9 @@ class UploadForm(forms.Form):
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("The snapshot already exists"),
|
_("The snapshot already exists"),
|
||||||
code="duplicate_snapshot",
|
code="duplicate_snapshot",
|
||||||
params={"file_name": file_name},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#Caught any error and display it as Validation Error so the Form handles it
|
#Catch any error and display it as Validation Error so the Form handles it
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ValidationError(
|
raise ValidationError(
|
||||||
_("Error on '%(file_name)s': %(error)s"),
|
_("Error on '%(file_name)s': %(error)s"),
|
||||||
|
|
|
@ -51,6 +51,7 @@ class UploadView(DashboardView, FormView):
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def form_invalid(self, form):
|
def form_invalid(self, form):
|
||||||
|
#TODO: change file_input field class to "is-invalid" if any errors occur
|
||||||
response = super().form_invalid(form)
|
response = super().form_invalid(form)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue