示例#1
0
 def __init__(self):
     self.client = SyncClient(settings.DJEESE_STORAGE_ID, settings.DJEESE_STORAGE_KEY, settings.DJEESE_STORAGE_HOST)
示例#2
0
class DjeeseFSStorage(Storage):
    def __init__(self):
        self.client = SyncClient(settings.DJEESE_STORAGE_ID, settings.DJEESE_STORAGE_KEY, settings.DJEESE_STORAGE_HOST)

    def delete(self, name):
        self.client.delete(name)

    def exists(self, name):
        return self.client.exists(name)

    def listdir(self, path):
        return self.client.listdir(path)

    def size(self, name):
        return self.client.size(name)

    def url(self, name):
        return self.client.url(name)

    def _open(self, name, mode='rb'):
        return DjeeseFile(self, name, mode)
    
    def _save(self, name, content):
        content.seek(0)
        self.client.save(name, content)
        return name
        
    def get_valid_name(self, name):
        return self.client.get_valid_name(name)
    
    def get_available_name(self, name):
        return self.client.get_available_name(name)
    
    def get_content(self, name):
        return self.client.get_content(name)