mirror of
https://github.com/lucaspalomodevelop/indico-plugins.git
synced 2026-03-13 07:29:39 +00:00
Storage/S3: create plugin
This commit is contained in:
parent
b2d99c144a
commit
eaf32f1153
0
storage_s3/indico_storage_s3/__init__.py
Normal file
0
storage_s3/indico_storage_s3/__init__.py
Normal file
62
storage_s3/indico_storage_s3/plugin.py
Normal file
62
storage_s3/indico_storage_s3/plugin.py
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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
|
||||
43
storage_s3/setup.py
Normal file
43
storage_s3/setup.py
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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'}}
|
||||
)
|
||||
Loading…
x
Reference in New Issue
Block a user