storagemanager.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:edmunds 作者: LowieHuyghe 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号