quetzal.app.api.data.storage package¶
-
quetzal.app.api.data.storage.
set_permissions
(file_obj, owner)¶ Set the permissions of the file
Change the data object file_obj permissions to set owner as the user that owns this file.
Parameters: Raises: quetzal.app.api.exceptions.QuetzalException
– When the storage backend is unknown. Exceptions by the dispatched functions are not captured here.
-
quetzal.app.api.data.storage.
upload
(filename, contents, location)¶ Upload a file
Upload the contents as a file named filename in location.
This function dispaches the upload operation on the configured storage backend.
Parameters: Returns: - url (str) – URL to where the file was uploaded.
- obj (object) – An object pointing where the file was uploaded for further manipulation. Its type depends on the data backend.
Raises: quetzal.app.api.exceptions.QuetzalException
– When the storage backend is unknown. Exceptions by the dispatched functions are not captured here.
Submodules¶
quetzal.app.api.data.storage.gcp module¶
-
quetzal.app.api.data.storage.gcp.
set_permissions
(blob, owner)¶
-
quetzal.app.api.data.storage.gcp.
upload
(filename, content, location)¶ Save a file on a local filesystem.
Implements the upload mechanism of the GCP backend.
Parameters: Returns: - url (str) – URL to the uploaded file. Its format will be
gs://url/to/file
. - blob_obj (
google.cloud.storage.blob.Blob
) – Blob object where the file was saved.
Raises: quetzal.app.api.exceptions.QuetzalException
– When the location is the global data bucket. This is not permitted.- url (str) – URL to the uploaded file. Its format will be
quetzal.app.api.data.storage.local module¶
-
quetzal.app.api.data.storage.local.
set_permissions
(file_obj, owner)¶
-
quetzal.app.api.data.storage.local.
upload
(filename, content, location)¶ Save a file on a local filesystem.
Implements the upload mechanism of the local file storage backend.
Parameters: Returns: - url (str) – URL to the uploaded file. Its format will be
file://absolute/path/to/file
. - path_obj (
pathlib.Path
) – Path object where the file was saved.
Raises: quetzal.app.api.exceptions.QuetzalException
– When the location is the global data directory. This is not permitted.- url (str) – URL to the uploaded file. Its format will be