From fa295ef4b7cf1e1454c3b9a0574d9793527e9b92 Mon Sep 17 00:00:00 2001 From: Patrick Totzke Date: Tue, 30 Aug 2011 12:41:48 +0100 Subject: fix no-results with abook lookup issue #42 --- alot/account.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'alot') 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) -- cgit v1.2.3