Esempio n. 1
0
 def put(self, content, identifier=None, bucket=DEFAULT_BUCKET, **kw):
     if self.puts is None:
         raise InvalidContext("AtomicBlobs context is not active")
     meta = self.db.put(content, identifier, bucket=bucket, **kw)
     if identifier is None and bucket == DEFAULT_BUCKET:
         self.puts.append(meta)
     else:
         self.old_api_puts.append((meta, bucket))
     return meta
Esempio n. 2
0
    def delete(self, key):
        """Delete a blob

        NOTE blobs will not actually be deleted until the context exits,
        so subsequent gets inside the context will return an object even
        though the blob or bucket has been queued for deletion.
        """
        if self.puts is None:
            raise InvalidContext("AtomicBlobs context is not active")
        self.deletes.append(key)
        return None  # result is unknown
Esempio n. 3
0
    def delete(self, *args, **kw):
        """Delete a blob or bucket of blobs

        NOTE blobs will not actually be deleted until the context exits,
        so subsequent gets inside the context will return an object even
        though the blob or bucket has been queued for deletion.
        """
        if self.puts is None:
            raise InvalidContext("AtomicBlobs context is not active")
        self.db.get_args_for_delete(*args, **kw)  # validate args
        self.deletes.append((args, kw))
        return None  # result is unknown
Esempio n. 4
0
    def delete(self, *args, **kw):
        """Delete a blob

        NOTE blobs will not actually be deleted until the context exits,
        so subsequent gets inside the context will return an object even
        though the blob or bucket has been queued for deletion.
        """
        if self.puts is None:
            raise InvalidContext("AtomicBlobs context is not active")
        if "key" in kw and not args:
            if set(kw) != {"key"}:
                notkey = ", ".join(k for k in kw if k != "key")
                raise TypeError("unexpected arguments: " + notkey)
            self.deletes.append(kw["key"])
        else:
            assert "key" not in kw, kw
            self.old_api_deletes.append((args, kw))
        return None  # result is unknown
Esempio n. 5
0
 def put(self, content, identifier, bucket=DEFAULT_BUCKET):
     if self.puts is None:
         raise InvalidContext("AtomicBlobs context is not active")
     info = self.db.put(content, identifier, bucket=bucket)
     self.puts.append((info, bucket))
     return info
Esempio n. 6
0
 def put(self, content, **kw):
     if self.puts is None:
         raise InvalidContext("AtomicBlobs context is not active")
     meta = self.db.put(content, **kw)
     self.puts.append(meta)
     return meta