Updated code quality ignore bare except warning & replaced unicode by decode function
This commit is contained in:
parent
bb9065ee07
commit
2303a4d4e5
|
@ -55,7 +55,7 @@ class smtpServerChannel(smtpd.SMTPChannel):
|
||||||
self.push('235 2.7.0 Authentication successful')
|
self.push('235 2.7.0 Authentication successful')
|
||||||
else:
|
else:
|
||||||
raise Exception("Auth fail")
|
raise Exception("Auth fail")
|
||||||
except:
|
except: # noqa:E722
|
||||||
self.push('501 Authentication fail')
|
self.push('501 Authentication fail')
|
||||||
|
|
||||||
def smtp_DATA(self, arg):
|
def smtp_DATA(self, arg):
|
||||||
|
@ -108,7 +108,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
||||||
ret = []
|
ret = []
|
||||||
for h in decode_header(self.msg_headers[hdr]):
|
for h in decode_header(self.msg_headers[hdr]):
|
||||||
if h[1]:
|
if h[1]:
|
||||||
ret.append(unicode(h[0], h[1]))
|
ret.append(h[0].decode(h[1]))
|
||||||
else:
|
else:
|
||||||
ret.append(h[0].decode("utf-8", errors='replace'))
|
ret.append(h[0].decode("utf-8", errors='replace'))
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
self.msg_headers = Parser().parsestr(data)
|
self.msg_headers = Parser().parsestr(data)
|
||||||
except:
|
except: # noqa:E722
|
||||||
logger.error('Invalid headers')
|
logger.error('Invalid headers')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
msg_subject = self.decode_header('subject')[0]
|
msg_subject = self.decode_header('subject')[0]
|
||||||
except:
|
except: # noqa:E722
|
||||||
msg_subject = "Subject missing..."
|
msg_subject = "Subject missing..."
|
||||||
|
|
||||||
msg_tmp = email.message_from_string(data)
|
msg_tmp = email.message_from_string(data)
|
||||||
|
|
Reference in New Issue
Block a user