summaryrefslogtreecommitdiff
path: root/src/leap/mx/couchdbhelper.py
diff options
context:
space:
mode:
authorTomas Touceda <chiiph@leap.se>2013-05-02 13:44:08 -0300
committerTomas Touceda <chiiph@leap.se>2013-05-02 13:44:08 -0300
commitf844d2de4ce4582737ce02a0c9c5e0b2ff4dd026 (patch)
treebb7ed84a1c58eedade652ad66f3f4e6bf2cc659c /src/leap/mx/couchdbhelper.py
parentc1eec313e873c9e2567db6798ef07f58953145da (diff)
Several fixes according to the review comments
Diffstat (limited to 'src/leap/mx/couchdbhelper.py')
-rw-r--r--src/leap/mx/couchdbhelper.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/leap/mx/couchdbhelper.py b/src/leap/mx/couchdbhelper.py
index 2f6b548..7c4c8ce 100644
--- a/src/leap/mx/couchdbhelper.py
+++ b/src/leap/mx/couchdbhelper.py
@@ -20,8 +20,6 @@ Classes for working with CouchDB or BigCouch instances which store email alias
maps, user UUIDs, and GPG keyIDs.
"""
-import logging
-
from functools import partial
try:
@@ -32,12 +30,11 @@ except ImportError:
try:
from twisted.internet import defer
+ from twisted.python import log
except ImportError:
print "This software requires Twisted. Please see the README file"
print "for instructions on getting required dependencies."
-logger = logging.getLogger(__name__)
-
class ConnectedCouchDB(client.CouchDB):
"""
@@ -84,9 +81,9 @@ class ConnectedCouchDB(client.CouchDB):
@param data: response from the listDB command
@type data: array
"""
- logger.msg("Available databases:")
+ log.msg("Available databases:")
for database in data:
- logger.msg(" * %s" % (database,))
+ log.msg(" * %s" % (database,))
def createDB(self, dbName):
"""
@@ -119,7 +116,7 @@ class ConnectedCouchDB(client.CouchDB):
reduce=False,
include_docs=True)
- d.addCallbacks(partial(self._get_uuid, alias), logger.error)
+ d.addCallbacks(partial(self._get_uuid, alias), log.err)
return d
@@ -138,14 +135,10 @@ class ConnectedCouchDB(client.CouchDB):
for row in result["rows"]:
if row["key"] == alias:
uuid = row["id"]
- try:
- self._cache[uuid] = row["doc"]["public_key"]
- except:
- pass # no public key for this user
+ self._cache[uuid] = row["doc"].get("public_key", None)
return uuid
return None
-
def getPubKey(self, uuid):
pubkey = None
try: