Skip to content

Commit

Permalink
fix(groups): dsp-tools should not allow group creation if group name …
Browse files Browse the repository at this point in the history
…already in use (DEV-798) (#183)

* Fix bug

* improve code
  • Loading branch information
irinaschubert committed Apr 12, 2022
1 parent ff36bc1 commit 8f168ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions knora/dsplib/utils/onto_create_ontology.py
Expand Up @@ -123,13 +123,13 @@ def create_groups(con: Connection, groups: list[dict[str, str]], project: Projec

# check if the group already exists, skip if so
all_groups: Optional[list[Group]] = Group.getAllGroups(con)

group_exists: bool = False
if all_groups:
for group_item in all_groups:
if group_item.project == project.id and group_item.name == group_name:
group_exists = True
group_exists = any(group_item.name == group_name for group_item in all_groups)

if group_exists:
print(f"WARN Group '{group_name}' already exists. Skipping...")
print(f"WARN Group name '{group_name}' already in use. Skipping...")
continue

# check if status is defined, set default value if not
Expand Down

0 comments on commit 8f168ca

Please sign in to comment.