From 7bbdd02cdaa4d29bb83660d52c11a1d5f4357c97 Mon Sep 17 00:00:00 2001 From: drebs Date: Thu, 22 May 2014 18:27:58 -0300 Subject: Properly raise when couch db does not exist. --- common/src/leap/soledad/common/couch.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'common/src/leap/soledad') 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() -- cgit v1.2.3