Skip to content

Commit a5bbc6f

Browse files
committed
fixtures: handles insert/replace scenario with files
* Deletes the files and returns a 404 message upon insert or replace files when using the --skip-files flag * Fixes cernopendata#2150
1 parent 02bfc25 commit a5bbc6f

File tree

1 file changed

+2
-1
lines changed
  • cernopendata/modules/fixtures

1 file changed

+2
-1
lines changed

cernopendata/modules/fixtures/cli.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def update_record(pid, schema, data, files, skip_files):
104104
"""Updates the given record."""
105105
record = Record.get_record(pid.object_uuid)
106106
with db.session.begin_nested():
107-
if record.files and not skip_files:
107+
if record.files and skip_files:
108108
bucket_id = record.files.bucket
109109
bucket = Bucket.get(bucket_id.id)
110110
for o in ObjectVersion.get_by_bucket(bucket).all():
@@ -114,6 +114,7 @@ def update_record(pid, schema, data, files, skip_files):
114114
record=record.model,
115115
bucket=bucket
116116
).delete()
117+
Bucket.delete(bucket.id)
117118
bucket_id.remove()
118119
db.session.commit()
119120
record.update(data)

0 commit comments

Comments
 (0)