summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2014-05-22 18:27:58 -0300
committerdrebs <drebs@leap.se>2014-05-22 18:44:06 -0300
commit7bbdd02cdaa4d29bb83660d52c11a1d5f4357c97 (patch)
treef5a03759bf7c03d251c46ecb8dc5a7fc01a05e03 /common
parentadec26112cb0338405f6e6916c06196214cdf348 (diff)
Properly raise when couch db does not exist.
Diffstat (limited to 'common')
-rw-r--r--common/src/leap/soledad/common/couch.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/common/src/leap/soledad/common/couch.py b/common/src/leap/soledad/common/couch.py
index f4696cee..3bc1f543 100644
--- a/common/src/leap/soledad/common/couch.py
+++ b/common/src/leap/soledad/common/couch.py
@@ -467,6 +467,10 @@ class CouchDatabase(CommonBackend):
self._database = Database(
urljoin(self._url, self._dbname),
self._session)
+ try:
+ self._database.info()
+ except ResourceNotFound:
+ raise DatabaseDoesNotExist()
if replica_uid is not None:
self._set_replica_uid(replica_uid)
if ensure_ddocs:
@@ -1541,8 +1545,8 @@ class CouchServerState(ServerState):
:param dbname: The name of the database to ensure.
:type dbname: str
- :return: The CouchDatabase object and the replica uid.
- :rtype: (CouchDatabase, str)
+ :raise Unauthorized: Always, because Soledad server is not allowed to
+ create databases.
"""
raise Unauthorized()
@@ -1552,6 +1556,9 @@ class CouchServerState(ServerState):
:param dbname: The name of the database to delete.
:type dbname: str
+
+ :raise Unauthorized: Always, because Soledad server is not allowed to
+ delete databases.
"""
raise Unauthorized()