diff options
author | drebs <drebs@leap.se> | 2012-12-03 16:08:49 -0200 |
---|---|---|
committer | drebs <drebs@leap.se> | 2012-12-03 16:08:49 -0200 |
commit | 5a64cff89649f89310ec30ac7743a4d0f11ea2ce (patch) | |
tree | 01b32954fcd16b08f9e5903dc76c6b8cdefbc1fd /openstack.py | |
parent | 802d3101eb1368eb52a195aee12368791edc64ac (diff) |
Add put_object for u1db OpenStack backend.
Diffstat (limited to 'openstack.py')
-rw-r--r-- | openstack.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/openstack.py b/openstack.py index 9bb4fddd..25f1a404 100644 --- a/openstack.py +++ b/openstack.py @@ -43,7 +43,16 @@ class OpenStackDatabase(CommonBackend): raise NotImplementedError(self.get_all_docs) def put_doc(self, doc): - raise NotImplementedError(self.put_doc) + if doc.doc_id is None: + raise errors.InvalidDocId() + self._check_doc_id(doc.doc_id) + self._check_doc_size(doc) + # TODO: check for conflicts? + new_rev = self._allocate_doc_rev(doc.rev) + headers = { 'X-Object-Meta-Rev' : new_rev } + self._connection.put_object(self._container, doc_id, doc.get_json(), + headers=headers) + return new_rev def delete_doc(self, doc): raise NotImplementedError(self.delete_doc) |