Compare commits

..

No commits in common. "3faa98a60e4f136254d89793af76da4464a87536" and "e4124fb20b11d2b63bde9e997c9a16a4fc36168a" have entirely different histories.

3 changed files with 6 additions and 16 deletions

View File

@ -58,7 +58,7 @@
<div class="col-lg-9 col-md-8">{{ object.type }}</div>
</div>
{% if object.is_websnapshot and object.last_user_evidence %}
{% if object.is_websnapshot %}
{% for k, v in object.last_user_evidence %}
<div class="row mb-3">
<div class="col-lg-3 col-md-4 label">{{ k }}</div>

View File

@ -37,8 +37,6 @@ class UploadForm(forms.Form):
if exist_annotation:
raise ValidationError("error: {} exist".format(file_name))
except ValueError:
raise ValidationError("Error in parsing JSON: {}. Check for file corruption.".format(file_name))
except Exception:
raise ValidationError("error in: {}".format(file_name))

View File

@ -37,8 +37,6 @@ class Command(BaseCommand):
elif os.path.isdir(path):
self.read_directory(path)
else:
raise ValueError(f"The path {path} is neither a file nor a directory")
self.parsing()
@ -49,19 +47,13 @@ class Command(BaseCommand):
self.open(filepath)
def open(self, filepath):
try:
with open(filepath, 'r') as file:
content = json.loads(file.read())
path_name = save_in_disk(content, self.user.institution.name)
self.snapshots.append((content, path_name))
except json.JSONDecodeError:
raise ValueError(f"Invalid JSON format in file {filepath}.")
#or we cath'em all
except Exception as e:
raise Exception(f"Oops! Something went wrong there")
with open(filepath, 'r') as file:
content = json.loads(file.read())
path_name = save_in_disk(content, self.user.institution.name)
self.snapshots.append((content, path_name))
def parsing(self):
for s, p in self.snapshots:
for s, p in self.snapshots:
try:
self.devices.append(Build(s, self.user))
move_json(p, self.user.institution.name)