From 84723eb8d34daa2717ef80dfa9a394c83c29b9c4 Mon Sep 17 00:00:00 2001 From: Francesco Siddi Date: Thu, 24 Mar 2016 16:05:39 +0100 Subject: [PATCH] Tweaks fo manage.py to allow default project creation --- pillar/manage.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pillar/manage.py b/pillar/manage.py index fd5ff85f..c5f5abbf 100755 --- a/pillar/manage.py +++ b/pillar/manage.py @@ -141,9 +141,12 @@ def setup_db(): summary='Default Project summary', category='training' ) - project = post_internal('projects', project) - print("Created default project {0}".format(project[0]['_id'])) - gcs_storage = GoogleCloudStorageBucket(str(project[0]['_id'])) + # Manually insert into db, since using post_internal would trigger hook + # TODO: fix this by bassing the context (and the user to g object) + projects_collection = app.data.driver.db['projects'] + project = projects_collection.insert_one(project) + print("Created default project {0}".format(project.inserted_id)) + gcs_storage = GoogleCloudStorageBucket(str(project.inserted_id)) if gcs_storage.bucket.exists(): print("Created CGS instance")