The new folder is named "turbot"
"Welcome to the channel for the {} hunt! ".format(hunt['name'])
+ "Please wait a moment or two while I create some backend resources.")
"Welcome to the channel for the {} hunt! ".format(hunt['name'])
+ "Please wait a moment or two while I create some backend resources.")
- # Create a new folder within Google drive for the hunt
- hunt['folder_id'] = sheets_create_folder(turb, hunt['hunt_id'])
+ # Create a new folder within Google drive for the hunt in two parts:
+
+ # ... first, a top-level folder named for the hunt
+ hunt_folder = sheets_create_folder(turb, hunt['hunt_id'])
+
+ # ... second, a folder within that named "turbot"
+ #
+ # The concept here is that non-turbot related content could
+ # be placed adjacent to the turbot folder.
+ hunt['folder_id'] = sheets_create_folder(turb, "turbot",
+ parents = [hunt_folder])
# Create a sheet for the hunt
sheet = sheets_create(turb, hunt['name'], hunt['folder_id'])
# Create a sheet for the hunt
sheet = sheets_create(turb, hunt['name'], hunt['folder_id'])
PUZZLE_TEMPLATE_SHEETS = ["Text", "Square grid", "Hex Grid",
"Formula reference: indexing"]
PUZZLE_TEMPLATE_SHEETS = ["Text", "Square grid", "Hex Grid",
"Formula reference: indexing"]
-def sheets_create_folder(turb, folder_name):
+def sheets_create_folder(turb, folder_name, parents = None):
"""Create a new folder within Google Drive
Returns the id of the created folder."""
"""Create a new folder within Google Drive
Returns the id of the created folder."""
"mimeType": "application/vnd.google-apps.folder"
}
"mimeType": "application/vnd.google-apps.folder"
}
+ if parents:
+ body["parents"] = parents
+
folder = turb.files.create(body=body, fields='id').execute()
return folder.get('id')
folder = turb.files.create(body=body, fields='id').execute()
return folder.get('id')