Fix mistakes in Exception() instantiation
This commit is contained in:
parent
5cf8ef06cc
commit
c99997dbb9
|
@ -21,6 +21,7 @@ from version import softwareVersion
|
||||||
SMTPDOMAIN = "bmaddr.lan"
|
SMTPDOMAIN = "bmaddr.lan"
|
||||||
LISTENPORT = 8425
|
LISTENPORT = 8425
|
||||||
|
|
||||||
|
|
||||||
class smtpServerChannel(smtpd.SMTPChannel):
|
class smtpServerChannel(smtpd.SMTPChannel):
|
||||||
def smtp_EHLO(self, arg):
|
def smtp_EHLO(self, arg):
|
||||||
if not arg:
|
if not arg:
|
||||||
|
@ -113,9 +114,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
||||||
try:
|
try:
|
||||||
sender, domain = p.sub(r'\1', mailfrom).split("@")
|
sender, domain = p.sub(r'\1', mailfrom).split("@")
|
||||||
if domain != SMTPDOMAIN:
|
if domain != SMTPDOMAIN:
|
||||||
raise Exception("Bad domain %s", domain)
|
raise Exception("Bad domain %s" % domain)
|
||||||
if sender not in BMConfigParser().addresses():
|
if sender not in BMConfigParser().addresses():
|
||||||
raise Exception("Nonexisting user %s", sender)
|
raise Exception("Nonexisting user %s" % sender)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.debug("Bad envelope from %s: %s", mailfrom, repr(err))
|
logger.debug("Bad envelope from %s: %s", mailfrom, repr(err))
|
||||||
msg_from = self.decode_header("from")
|
msg_from = self.decode_header("from")
|
||||||
|
@ -123,9 +124,9 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
||||||
msg_from = p.sub(r'\1', self.decode_header("from")[0])
|
msg_from = p.sub(r'\1', self.decode_header("from")[0])
|
||||||
sender, domain = msg_from.split("@")
|
sender, domain = msg_from.split("@")
|
||||||
if domain != SMTPDOMAIN:
|
if domain != SMTPDOMAIN:
|
||||||
raise Exception("Bad domain %s", domain)
|
raise Exception("Bad domain %s" % domain)
|
||||||
if sender not in BMConfigParser().addresses():
|
if sender not in BMConfigParser().addresses():
|
||||||
raise Exception("Nonexisting user %s", sender)
|
raise Exception("Nonexisting user %s" % sender)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error("Bad headers from %s: %s", msg_from, repr(err))
|
logger.error("Bad headers from %s: %s", msg_from, repr(err))
|
||||||
return
|
return
|
||||||
|
@ -145,7 +146,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
||||||
try:
|
try:
|
||||||
rcpt, domain = p.sub(r'\1', to).split("@")
|
rcpt, domain = p.sub(r'\1', to).split("@")
|
||||||
if domain != SMTPDOMAIN:
|
if domain != SMTPDOMAIN:
|
||||||
raise Exception("Bad domain %s", domain)
|
raise Exception("Bad domain %s" % domain)
|
||||||
logger.debug("Sending %s to %s about %s", sender, rcpt, msg_subject)
|
logger.debug("Sending %s to %s about %s", sender, rcpt, msg_subject)
|
||||||
self.send(sender, rcpt, msg_subject, body)
|
self.send(sender, rcpt, msg_subject, body)
|
||||||
logger.info("Relayed %s to %s", sender, rcpt)
|
logger.info("Relayed %s to %s", sender, rcpt)
|
||||||
|
|
|
@ -258,7 +258,7 @@ class namecoinConnection(object):
|
||||||
resp = self.con.getresponse()
|
resp = self.con.getresponse()
|
||||||
result = resp.read()
|
result = resp.read()
|
||||||
if resp.status != 200:
|
if resp.status != 200:
|
||||||
raise Exception("Namecoin returned status %i: %s" % resp.status, resp.reason)
|
raise Exception("Namecoin returned status %i: %s" % (resp.status, resp.reason))
|
||||||
except:
|
except:
|
||||||
logger.info("HTTP receive error")
|
logger.info("HTTP receive error")
|
||||||
except:
|
except:
|
||||||
|
@ -288,7 +288,7 @@ class namecoinConnection(object):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
except socket.error as exc:
|
except socket.error as exc:
|
||||||
raise Exception("Socket error in RPC connection: %s" % str(exc))
|
raise Exception("Socket error in RPC connection: %s" % exc)
|
||||||
|
|
||||||
|
|
||||||
def lookupNamecoinFolder():
|
def lookupNamecoinFolder():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user