Extract-email now avoids crashing on unlinked api keys

This commit is contained in:
2010-11-26 10:13:44 +00:00
parent 7ecd6f4db5
commit f6c320a6ce

View File

@@ -32,8 +32,9 @@ for char in chars:
if len(char.eveaccount_set.all()) > 0: if len(char.eveaccount_set.all()) > 0:
name = unicodedata.normalize('NFKD', char.name).encode('ASCII', 'ignore') name = unicodedata.normalize('NFKD', char.name).encode('ASCII', 'ignore')
charname = re.sub('[^a-zA-Z0-9_-]+', '', name) charname = re.sub('[^a-zA-Z0-9_-]+', '', name)
if char.eveaccount_set.all()[0].user:
email = char.eveaccount_set.all()[0].user.email email = char.eveaccount_set.all()[0].user.email
out[charname] = email out[charname.lower()] = email
for key in out: for key in out: