Skip to content

Commit 5dc9794

Browse files
authored
Merge pull request alephdata#3573 from adryd325/patch-1
Don't rename existing collections when running crawldir
2 parents 5318c77 + 7d79d9b commit 5dc9794

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

aleph/manage.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,16 @@ def get_collection(foreign_id):
6666

6767

6868
def ensure_collection(foreign_id, label):
69-
authz = Authz.from_role(Role.load_cli_user())
70-
config = {
71-
"foreign_id": foreign_id,
72-
"label": label,
73-
}
74-
create_collection(config, authz)
75-
return Collection.by_foreign_id(foreign_id)
69+
collection = Collection.by_foreign_id(foreign_id, deleted=True)
70+
if collection is None:
71+
authz = Authz.from_role(Role.load_cli_user())
72+
config = {
73+
"foreign_id": foreign_id,
74+
"label": label,
75+
}
76+
create_collection(config, authz)
77+
return Collection.by_foreign_id(foreign_id)
78+
return collection
7679

7780

7881
@click.group(cls=FlaskGroup, create_app=create_app)

0 commit comments

Comments
 (0)