Skip to content
Snippets Groups Projects
Verified Commit 8241e608 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

FIX: missing uploads due to unchanged checksum

parent ca0a197e
No related branches found
No related tags found
No related merge requests found
......@@ -104,5 +104,5 @@ style:
stage: style
image: $CI_REGISTRY_IMAGE
script:
- autopep8 -r --diff --exit-code .
- autopep8 -ar --diff --exit-code .
allow_failure: true
......@@ -110,7 +110,7 @@ def main(rec_id):
try:
el.download(target)
print("Downloaded:", target)
except:
except BaseException:
print("Failed download of:", target)
for ent in cont:
......@@ -128,6 +128,7 @@ def defineParser():
'-i',
'--id',
type=int,
required=True,
help='the id of the record that shall be copied and then changed')
return parser
......
......@@ -58,6 +58,7 @@ def main(filename, rerun=False):
for el in cont:
if isinstance(el, db.File):
el._checksum = None
target = os.path.join("downloads", el.path[1:])
if os.path.exists(target):
......@@ -69,32 +70,11 @@ def main(filename, rerun=False):
if (isinstance(el, db.Property) or isinstance(el, db.RecordType)):
model.append(el)
# create new file objects and replace the existing one
# TODO why is this necessary?
new_files = []
print(files)
if not rerun:
for fi in files:
new = db.File(file=fi.file, path=fi.path, name=fi.name, id=fi.id,
description=fi.description)
for p in fi.parents:
new.add_parent(p)
new_files.append(new)
else:
for fi in files:
new = db.File(path=fi.path, id=fi.id)
new_files.append(new)
# remove entities of the model from the container
for el in model+files:
cont.remove(el)
files = new_files
id_mapping = {}
for el in model+files:
......@@ -108,12 +88,10 @@ def main(filename, rerun=False):
# insert files
if not rerun:
for i, el in enumerate(files):
print(el)
for _, el in enumerate(files):
r = el.insert(unique=False)
print(r)
else:
for i, el in enumerate(files):
for _, el in enumerate(files):
el.id = None
el.retrieve()
......
......@@ -147,7 +147,7 @@ it is not at the beginning, it must be preceded by a blank line.
raise ParseErrorsInHeader(filename, e)
# except yaml.error.MarkedYAMLError as e:
# raise NoValidHeader(filename)
if type(yaml_part) != dict:
if not isinstance(yaml_part, dict):
raise NoValidHeader(filename)
return (found_1, found_2, clean_header(yaml_part))
......@@ -229,7 +229,7 @@ def clean_header(header):
for k, v in header.items():
# Plain string is put into list
if type(v) == str:
if isinstance(v, str):
header[k] = [v]
return header
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment