def _create_google_cloud_storage(self, config):
"""
Create GoogleCloudStorage instance
:param config: The config
:type config: dict
:return: GoogleCloudStorage instance
:rtype: GoogleCloudStorage
"""
from google.appengine.api import app_identity
bucket = app_identity.get_default_gcs_bucket_name()
if 'bucket' in config:
bucket = config['bucket']
storage_path = os.path.join(os.sep, self._storage_path)
if 'directory' in config:
directory = config['directory']
# Check if absolute or relative path
if not directory.startswith(os.sep):
storage_path = os.path.join(storage_path, directory)
else:
storage_path = directory
files_path = self._files_path
if 'files_path' in config:
files_path = config['files_path']
options = {}
if 'prefix' in config:
options['prefix'] = config['prefix']
from edmunds.storage.drivers.googlecloudstorage import GoogleCloudStorage
return GoogleCloudStorage(self._app, bucket, storage_path, files_path, **options)
评论列表
文章目录