mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Cleaned up project deletion code
This commit is contained in:
parent
13a4c7201e
commit
bcea2c70a2
1 changed files with 8 additions and 12 deletions
|
|
@ -149,20 +149,16 @@ class Listener:
|
|||
"""Delete project."""
|
||||
|
||||
collections = self.dbcon.database.list_collection_names()
|
||||
project_name = None
|
||||
for collection in collections:
|
||||
post = self.dbcon.database[collection].find_one(
|
||||
{"data.zou_id": data['project_id']})
|
||||
if post:
|
||||
project_name = post['name']
|
||||
break
|
||||
project = self.dbcon.database[collection].find_one(
|
||||
{"data.zou_id": data["project_id"]})
|
||||
if project:
|
||||
# Delete project collection
|
||||
self.dbcon.database[project["name"]].drop()
|
||||
|
||||
if project_name:
|
||||
# Delete project collection
|
||||
self.dbcon.database[project_name].drop()
|
||||
|
||||
# Print message
|
||||
log.info("Project deleted: {}".format(project_name))
|
||||
# Print message
|
||||
log.info("Project deleted: {}".format(project["name"]))
|
||||
return
|
||||
|
||||
# == Asset ==
|
||||
def _new_asset(self, data):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue