ignore unparsable vcards. fixes #2826

This commit is contained in:
Yann Leboulanger 2007-01-12 10:10:01 +00:00
parent 775b85a83e
commit 476908a54b
1 changed files with 6 additions and 1 deletions

View File

@ -886,7 +886,12 @@ class ConnectionVcard:
f = open(path_to_file) f = open(path_to_file)
c = f.read() c = f.read()
f.close() f.close()
card = common.xmpp.Node(node = c) try:
card = common.xmpp.Node(node = c)
except:
# We are unable to parse it. Remove it
os.remove(path_to_file)
return None
vcard = self.node_to_dict(card) vcard = self.node_to_dict(card)
if vcard.has_key('PHOTO'): if vcard.has_key('PHOTO'):
if not isinstance(vcard['PHOTO'], dict): if not isinstance(vcard['PHOTO'], dict):