fallback in contact indexer

This commit is contained in:
Frédéric Péters 2011-12-21 17:30:48 +01:00
parent aacf8f5342
commit 01daea0c13
1 changed files with 8 additions and 2 deletions

View File

@ -153,7 +153,10 @@ def contactIndexer(obj):
v = v[0]
if ':' in v:
src = ContactsSource()
r = src.fastGetTitleByToken(obj, v)
try:
r = src.fastGetTitleByToken(obj, v)
except KeyError:
continue
if not type(r) is unicode:
r = unicode(r, 'utf-8')
return r
@ -176,7 +179,10 @@ def contactFuzzyIndexer(obj):
v = v[0]
if ':' in v:
src = ContactsSource()
r = src.fastGetTitleByToken(obj, v)
try:
r = src.fastGetTitleByToken(obj, v)
except KeyError:
return v.split(':')[1:]
if not type(r) is unicode:
r = unicode(r, 'utf-8')
return r