Exemple #1
0
    def __init__(self, *args, **kwargs):
        self._base_url = getattr(settings, 'FILE_STORAGE',
                                 '/uds/utility/files')
        if self._base_url[-1] != '/':
            self._base_url += '/'

        cacheName: str = getattr(settings, 'FILE_CACHE', 'memory')

        try:
            cache = caches[cacheName]
        except Exception:
            logger.info('No cache for FileStorage configured.')
            self.cache = None
            return

        self.cache = cache
        if 'owner' in kwargs:
            self.owner = kwargs.get('owner')
            del kwargs['owner']
        else:
            self.owner = 'fstor'

        # On start, ensures that cache is empty to avoid surprises
        self.cache._cache.flush_all()  # pylint: disable=protected-access

        Storage.__init__(self, *args, **kwargs)
Exemple #2
0
 def __init__(self, hosts=None, base_url=None):
     DistributedStorageMixin.__init__(self, hosts, base_url)
     if not self.fatal_exceptions:
         logger.warning("You're using the DistributedStorage backend with "
                 "RESTO_FATAL_EXCEPTIONS = %r.", self.fatal_exceptions)
         logger.warning("This is prone to data-loss problems, and I won't "
                 "take any responsibility in what happens from now on.")
         logger.warning("You have been warned.")
     Storage.__init__(self)
Exemple #3
0
 def __init__(self, hosts=None, base_url=None):
     DistributedStorageMixin.__init__(self, hosts, base_url)
     if not self.fatal_exceptions:
         logger.warning(
             "You're using the DistributedStorage backend with "
             "RESTO_FATAL_EXCEPTIONS = %r.", self.fatal_exceptions)
         logger.warning(
             "This is prone to data-loss problems, and I won't "
             "take any responsibility in what happens from now on.")
         logger.warning("You have been warned.")
     Storage.__init__(self)
Exemple #4
0
    def __init__(self, *args, **kwargs):
        self._base_url = getattr(settings, 'FILE_STORAGE', '/files')
        if self._base_url[-1] != '/':
            self._base_url += '/'

        cacheName = getattr(settings, 'FILE_CACHE', 'memory')

        try:
            cache = caches[cacheName]
        except:
            logger.info('No cache for FileStorage configured.')
            cache = None

        self.cache = cache
        if 'owner' in kwargs:
            self.owner = kwargs.get('owner')
            del kwargs['owner']
        else:
            self.owner = 'fstor'

        self.cache._cache.flush_all()  # On start, ensures that cache is empty to avoid surprises

        Storage.__init__(self, *args, **kwargs)  # @UndefinedVariable
Exemple #5
0
    def __init__(self, *args, **kwargs):
        self._base_url = getattr(settings, 'FILE_STORAGE', '/files')
        if self._base_url[-1] != '/':
            self._base_url += '/'

        cacheName = getattr(settings, 'FILE_CACHE', 'memory')

        try:
            cache = caches[cacheName]
        except:
            cache = None

        self.cache = cache
        if 'owner' in kwargs:
            self.owner = kwargs.get('owner')
            del kwargs['owner']
        else:
            self.owner = 'fstor'

        self.cache._cache.flush_all()  # On start, ensures that cache is empty to avoid surprises

        # noinspection PyArgumentList
        Storage.__init__(self, *args, **kwargs)
Exemple #6
0
    def __init__(self, *args, **kwargs):
        self._base_url = getattr(settings, 'FILE_STORAGE', '/files')
        if self._base_url[-1] != '/':
            self._base_url += '/'

        cacheName = getattr(settings, 'FILE_CACHE', 'memory')

        try:
            cache = caches[cacheName]
        except:
            cache = None

        self.cache = cache
        if 'owner' in kwargs:
            self.owner = kwargs.get('owner')
            del kwargs['owner']
        else:
            self.owner = 'fstor'

        self.cache._cache.flush_all(
        )  # On start, ensures that cache is empty to avoid surprises

        # noinspection PyArgumentList
        Storage.__init__(self, *args, **kwargs)
Exemple #7
0
    def __init__(self, *args, **kwargs):
        self._base_url = getattr(settings, 'FILE_STORAGE', '/files')
        if self._base_url[-1] != '/':
            self._base_url += '/'

        cacheName = getattr(settings, 'FILE_CACHE', 'memory')

        try:
            cache = caches[cacheName]
        except:
            logger.info('No cache for FileStorage configured.')
            cache = None

        self.cache = cache
        if 'owner' in kwargs:
            self.owner = kwargs.get('owner')
            del kwargs['owner']
        else:
            self.owner = 'fstor'

        self.cache._cache.flush_all(
        )  # On start, ensures that cache is empty to avoid surprises

        Storage.__init__(self, *args, **kwargs)
Exemple #8
0
 def __init__(self, *args, **kwargs):
     Storage.__init__(self, *args, **kwargs)
     ensure_bucket_exists(StaticFilesBucket)
 def __init__(self, *args, **kwargs):
     Storage.__init__(self, *args, **kwargs)