summaryrefslogtreecommitdiff
path: root/src/leap/soledad/__init__.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-04-19 21:26:39 -0300
committerdrebs <drebs@leap.se>2013-04-19 21:26:39 -0300
commit23e1a6404d31070364654b8138cfe21f07239974 (patch)
treef7f90680412b8abe265d69ebfb31bc2dee7565a4 /src/leap/soledad/__init__.py
parent716bec111f4ba319419dd8e4abb7af7905b495ac (diff)
Add create_doc_from_json() to API.
Diffstat (limited to 'src/leap/soledad/__init__.py')
-rw-r--r--src/leap/soledad/__init__.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/leap/soledad/__init__.py b/src/leap/soledad/__init__.py
index f88a68bf..3c4fc801 100644
--- a/src/leap/soledad/__init__.py
+++ b/src/leap/soledad/__init__.py
@@ -628,6 +628,25 @@ class Soledad(object):
"""
return self._db.create_doc(content, doc_id=doc_id)
+ def create_doc_from_json(self, json, doc_id=None):
+ """
+ Create a new document.
+
+ You can optionally specify the document identifier, but the document
+ must not already exist. See 'put_doc' if you want to override an
+ existing document.
+ If the database specifies a maximum document size and the document
+ exceeds it, create will fail and raise a DocumentTooBig exception.
+
+ @param json: The JSON document string
+ @type json: str
+ @param doc_id: An optional identifier specifying the document id.
+ @type doc_id:
+ @return: The new cocument
+ @rtype: LeapDocument
+ """
+ return self._db.create_doc_from_json(json, doc_id=doc_id)
+
def get_doc_conflicts(self, doc_id):
"""
Get the list of conflicts for the given document.