Beispiel #1
0
 def get_object(self, name):
     name = self._normalize_name(self._clean_name(name))
     try:
         ob = self.connection.get(self.bucket, name)
         return ob
     except sae.storage.ObjectNotExistsError, e:
         reraise(e)
Beispiel #2
0
 def create_folder(self, name=None):
     if not name:
         name = self.folder_name
     try:
         bucket = self.connection.create_bucket(name)
         bucket.set_acl(self.bucket_acl)
     except S3CreateError, e:
         reraise(e)
Beispiel #3
0
            force_http=not self.secure_urls,
        )

    @property
    def file_class(self):
        return SaeStorageFile

    def get_object(self, name):
        name = self._normalize_name(self._clean_name(name))
        try:
            ob = self.connection.get(self.bucket, name)
            return ob
        except sae.storage.ObjectNotExistsError, e:
            reraise(e)
        except Exception, e:
            reraise(e)

    def get_object_attr(self, name):
        name = self._normalize_name(self._clean_name(name))

        stat = self.connection.stat(self.bucket, name)
        return stat

    def _read(self, name):
        memory_file = StringIO()
        try:
            o = self.get_object(name)
            memory_file.write(o.data)
        except sae.storage.ObjectNotExistsError, e:
            pass
        return memory_file