[or-cvs] r14689: Catch BadEmail exception (bridgedb/trunk/lib/bridgedb)
nickm at seul.org
nickm at seul.org
Thu May 22 20:29:51 UTC 2008
Author: nickm
Date: 2008-05-22 16:29:50 -0400 (Thu, 22 May 2008)
New Revision: 14689
Modified:
bridgedb/trunk/lib/bridgedb/Dist.py
bridgedb/trunk/lib/bridgedb/Server.py
Log:
Catch BadEmail exception
Modified: bridgedb/trunk/lib/bridgedb/Dist.py
===================================================================
--- bridgedb/trunk/lib/bridgedb/Dist.py 2008-05-22 17:13:55 UTC (rev 14688)
+++ bridgedb/trunk/lib/bridgedb/Dist.py 2008-05-22 20:29:50 UTC (rev 14689)
@@ -206,8 +206,11 @@
be any string, so long as it changes with every period.
N -- the number of bridges to try to give back.
"""
- emailaddress = normalizeEmail(emailaddress, self.domainmap,
+ try:
+ emailaddress = normalizeEmail(emailaddress, self.domainmap,
self.domainrules)
+ except BadEmail:
+ return [] #XXXX log the exception
if emailaddress is None:
return [] #XXXX raise an exception.
if self.store.has_key(emailaddress):
Modified: bridgedb/trunk/lib/bridgedb/Server.py
===================================================================
--- bridgedb/trunk/lib/bridgedb/Server.py 2008-05-22 17:13:55 UTC (rev 14688)
+++ bridgedb/trunk/lib/bridgedb/Server.py 2008-05-22 20:29:50 UTC (rev 14689)
@@ -182,7 +182,11 @@
logging.info("No From or Sender header on incoming mail.")
return None,None
- _, addrdomain = bridgedb.Dist.extractAddrSpec(clientAddr.lower())
+ try:
+ _, addrdomain = bridgedb.Dist.extractAddrSpec(clientAddr.lower())
+ except bridgedb.Dist.BadEmail:
+ logging.info("Ignoring bad address on incoming email.")
+ return None,None
if not addrdomain:
logging.info("Couldn't parse domain from %r", clientAddr)
if addrdomain and ctx.cfg.EMAIL_DOMAIN_MAP:
More information about the tor-commits
mailing list