class ExhibitStorage(FileSystemStorage): """ Assume that incoming paths are of the form <username>/.../... """ def __init__(self, *args, **kwargs): self.__userdata_storage = FileSystemStorage(location=kwargs['location'], base_url=kwargs['base_url']) def _open(self, name, mode='rb'): return self.__userdata_storage._open(chunk_path(name) + name, mode) def _save(self, name, content): chunk = chunk_path(name) fullname = chunk + name if (self.__userdata_storage.exists(fullname)): self.__userdata_storage.delete(fullname) result = self.__userdata_storage._save(fullname, content) return result.partition(chunk)[2] def exists(self, name): return self.__userdata_storage.exists(chunk_path(name) + name) def path(self, name): return self.__userdata_storage.path(chunk_path(name) + name) def size(self, name): return self.__userdata_storage.size(chunk_path(name) + name) def delete(self, name): return self.__userdata_storage.delete(chunk_path(name) + name) def url(self, name): return self.__userdata_storage.url(name) def get_available_name(self, name): return self.__userdata_storage.get_available_n
def _open(self, name, mode="rb"): self.__log("Opening file " + name + " in mode=" + mode) return FileSystemStorage._open(self, name, mode)
def _open(self, name, mode='rb'): # Writing is forbidden, see DistributedStorage._open. if mode != 'rb': # cover: disable raise IOError('Unsupported mode %r, use %r.' % (mode, 'rb')) return FileSystemStorage._open(self, name, mode)
def _open(self, name, mode='rb'): if self.is_thumbor(name): return ThumborStorage._open(self, name, mode) else: return FileSystemStorage._open(self, name, mode)
def _open(self, name, mode='rb'): self.__log('Opening file ' + name + ' in mode=' + mode) return FileSystemStorage._open(self, name, mode)
def _open(self, name, mode='rb'): if self.is_thumbor(name): return ThumborStorage._open(self, name, mode) return FileSystemStorage._open(self, name, mode)
def _open(self, name, mode="rb"): file_system = FileSystemStorage() return file_system._open(name, mode)
def _open(self, name, mode='rb'): # Writing is forbidden, see DistributedStorageMixin._open. if mode != 'rb': raise IOError('Unsupported mode %r, use %r.' % (mode, 'rb')) return FileSystemStorage._open(self, name, mode)