summaryrefslogtreecommitdiff
path: root/alot
diff options
context:
space:
mode:
authorPatrick Totzke <patricktotzke@gmail.com>2011-08-30 12:41:48 +0100
committerPatrick Totzke <patricktotzke@gmail.com>2011-08-30 12:41:48 +0100
commitfa295ef4b7cf1e1454c3b9a0574d9793527e9b92 (patch)
tree93fa0d1eedfbc31beb359e490f49435b4057a717 /alot
parent326b2a26642baeccda41b72b8e7ed413b9ed6841 (diff)
fix no-results with abook lookup
issue #42
Diffstat (limited to 'alot')
-rw-r--r--alot/account.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/alot/account.py b/alot/account.py
index f0e68fc2..0447d0a8 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -201,7 +201,7 @@ class AccountManager:
rgexp = config.get(s, 'abook_regexp')
options.remove('abook_regexp')
else:
- regexp = None
+ regexp = None # will use default in constructor
args['abook'] = MatchSdtoutAddressbook(cmd, match=regexp)
to_set = self.manditory
@@ -296,8 +296,10 @@ class MatchSdtoutAddressbook(AddressBook):
return self.lookup('\'\'')
def lookup(self, prefix):
- lines = cmd_output('%s %s' % (self.command, prefix))
- lines = lines.replace('\t', ' ' * 4).splitlines()
+ resultstring = cmd_output('%s %s' % (self.command, prefix))
+ if not resultstring:
+ return []
+ lines = resultstring.replace('\t', ' ' * 4).splitlines()
res = []
for l in lines:
m = re.match(self.match, l)