[tor-commits] [bridgedb/master] Raise a BadEmail if we couldn't parse an email address in Dist.
isis at torproject.org
isis at torproject.org
Fri May 16 18:52:52 UTC 2014
commit 91a8a68798e745a764294cafe2013f29710b4305
Author: Isis Lovecruft <isis at torproject.org>
Date: Mon May 5 19:07:10 2014 +0000
Raise a BadEmail if we couldn't parse an email address in Dist.
---
lib/bridgedb/Dist.py | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/lib/bridgedb/Dist.py b/lib/bridgedb/Dist.py
index 934c0b0..580aa5d 100644
--- a/lib/bridgedb/Dist.py
+++ b/lib/bridgedb/Dist.py
@@ -399,16 +399,19 @@ class EmailBasedDistributor(Distributor):
if not bridgeFilterRules:
bridgeFilterRules=[]
now = time.time()
+
+ emailaddr = None
try:
- emailaddress = addr.normalizeEmail(emailaddress, self.domainmap,
- self.domainrules)
- except addr.BadEmail as err:
- logging.warn(err)
+ emailaddr = addr.normalizeEmail(emailaddress,
+ self.domainmap,
+ self.domainrules)
+ if not emailaddr:
+ raise addr.BadEmail("Couldn't normalize email address: %r"
+ % emailaddress)
+ except addr.BadEmail as error:
+ logging.warn(error)
return []
- if not emailaddress:
- return [] #XXXX raise an exception.
-
with bridgedb.Storage.getDB() as db:
wasWarned = db.getWarnedEmail(emailaddress)
lastSaw = db.getEmailTime(emailaddress)
More information about the tor-commits
mailing list