summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-03-05 19:55:42 -0300
committerdrebs <drebs@leap.se>2013-03-05 19:55:42 -0300
commit4672ec4f25daa6466b2850bea416eaf77fa90d9d (patch)
tree169ee471797567e66e49a6fd6befb09709b3fb69
parentc38004260d139a3d4c05f1d8dfd0dbfca281e012 (diff)
Outsource unauth request.
-rw-r--r--shared_db.py21
1 files changed, 3 insertions, 18 deletions
diff --git a/shared_db.py b/shared_db.py
index 9694db2b..c27bba71 100644
--- a/shared_db.py
+++ b/shared_db.py
@@ -99,21 +99,6 @@ class SoledadSharedDatabase(http_database.HTTPDatabase):
"""
Modified method to allow for unauth request.
"""
- try:
- res, headers = self._request(
- 'GET', ['doc', doc_id], {"include_deleted": False},
- auth=False)
- except errors.DocumentDoesNotExist:
- return None
- except errors.HTTPError, e:
- if (e.status == http_database.DOCUMENT_DELETED_STATUS and
- 'x-u1db-rev' in e.headers):
- res = None
- headers = e.headers
- else:
- raise
- doc_rev = headers['x-u1db-rev']
- has_conflicts = json.loads(headers['x-u1db-has-conflicts'])
- doc = self._factory(doc_id, doc_rev, res)
- doc.has_conflicts = has_conflicts
- return doc
+ db = http_database.HTTPDatabase(self._url, factory=self._factory,
+ creds=self._creds)
+ return db.get_doc(doc_id)