summaryrefslogtreecommitdiff
path: root/src/leap/mx/alias_resolver.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2015-04-09 17:18:37 -0300
committerdrebs <drebs@leap.se>2015-04-09 18:20:00 -0300
commitb0ef529cc882a96903597fb5279919969fa286c3 (patch)
tree2243cd550e3e0769880b350184b5f5a3653c362a /src/leap/mx/alias_resolver.py
parent45adb4d6cfdb8b9ed11e3efc398d00ec6dbdc0b0 (diff)
[refactor] use couch reduced views for lookups
The way uuid and pgp key were being queried by means of couch views was not efficient because they weren't using the reduce function and were filtering the views results in the python code. Also, the uuid is not actually needed to find out either if the address exists or if there's a pgp public key for that address. This commit refactors the couch helper to make use of the reduce functions in queried views and to get rid of the intermediate uuid querying.
Diffstat (limited to 'src/leap/mx/alias_resolver.py')
-rw-r--r--src/leap/mx/alias_resolver.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/leap/mx/alias_resolver.py b/src/leap/mx/alias_resolver.py
index a139dd0..dd631c8 100644
--- a/src/leap/mx/alias_resolver.py
+++ b/src/leap/mx/alias_resolver.py
@@ -40,22 +40,22 @@ class LEAPPostfixTCPMapAliasServer(postfix.PostfixTCPMapServer):
A postfix tcp map alias resolver server.
"""
- def _cbGot(self, uuid):
+ def _cbGot(self, address):
"""
Return a code and message depending on the result of the factory's
get().
- :param value: The uuid.
- :type value: list
+ :param address: The address returned by the factory.
+ :type address: str
"""
- if uuid is None:
+ if address is None:
self.sendCode(
TCP_MAP_CODE_PERMANENT_FAILURE,
postfix.quote("NOT FOUND SRY"))
else:
self.sendCode(
TCP_MAP_CODE_SUCCESS,
- postfix.quote(uuid))
+ postfix.quote(address))
class AliasResolverFactory(LEAPPostfixTCPMapServerFactory):