diff --git a/storage_s3/indico_storage_s3/__init__.py b/storage_s3/indico_storage_s3/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/storage_s3/indico_storage_s3/plugin.py b/storage_s3/indico_storage_s3/plugin.py new file mode 100644 index 0000000..a552247 --- /dev/null +++ b/storage_s3/indico_storage_s3/plugin.py @@ -0,0 +1,62 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# Indico is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Indico; if not, see . + +from __future__ import unicode_literals + +import ast + +from indico.core.plugins import IndicoPlugin +from indico.core.storage import Storage +from indico.core import signals + + +class S3StoragePlugin(IndicoPlugin): + """S3 Storage + + Provides S3 storage backends. + """ + + def init(self): + super(S3StoragePlugin, self).init() + self.connect(signals.get_storage_backends, self._get_storage_backends) + + def _get_storage_backends(self, sender, **kwargs): + return S3Storage + + +class S3Storage(Storage): + name = 's3' + simple_data = False + + def __init__(self, data): + data = self._parse_data(data) + self.could_host = data['host'] + self.datestamp = bool(ast.literal_eval(data.get('datestamp', 'False').title())) + + def open(self, file_id): + pass + + def save(self, file_id): + pass + + def delete(self, file_id): + pass + + def getsize(self, file_id): + pass + + def send_file(self, file_id): + pass diff --git a/storage_s3/setup.py b/storage_s3/setup.py new file mode 100644 index 0000000..f4dc3fa --- /dev/null +++ b/storage_s3/setup.py @@ -0,0 +1,43 @@ +# This file is part of Indico. +# Copyright (C) 2002 - 2018 European Organization for Nuclear Research (CERN). +# +# Indico is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 3 of the +# License, or (at your option) any later version. +# +# Indico is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Indico; if not, see . + +from __future__ import unicode_literals + +from setuptools import setup + + +setup( + name='indico-plugin-storage-s3', + version='1.0', + description='S3 storage backend for Indico', + url='https://github.com/indico/indico-plugins', + license='https://www.gnu.org/licenses/gpl-3.0.txt', + author='Indico Team', + author_email='indico-team@cern.ch', + py_modules=('indico_storage_s3',), + zip_safe=False, + platforms='any', + install_requires=[ + 'indico>=2.0', + ], + classifiers=[ + 'Environment :: Plugins', + 'Environment :: Web Environment', + 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', + 'Programming Language :: Python :: 2.7' + ], + entry_points={'indico.plugins': {'storage_s3 = indico_storage_cloud:S3StoragePlugin'}} +)