diff options
Diffstat (limited to 'interfaces/email/interactive/send_pgp_mime.py')
-rw-r--r-- | interfaces/email/interactive/send_pgp_mime.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/interfaces/email/interactive/send_pgp_mime.py b/interfaces/email/interactive/send_pgp_mime.py index 42a0a8c..c70da23 100644 --- a/interfaces/email/interactive/send_pgp_mime.py +++ b/interfaces/email/interactive/send_pgp_mime.py @@ -128,7 +128,7 @@ def mail(msg, sendmail=None): the local host doesn't have an SMTP server set up for easy smtplib usage. """ - if sendmail != None: + if sendmail is not None: execute(sendmail, stdin=flatten(msg)) return None s = smtplib.SMTP() @@ -167,11 +167,11 @@ def guess_encoding(text): pass else: break - assert encoding != None + assert encoding is not None return encoding def encodedMIMEText(body, encoding=None): - if encoding == None: + if encoding is None: encoding = guess_encoding(body) if encoding == "us-ascii": return MIMEText(body) @@ -223,7 +223,7 @@ def replace(template, format_char, replacement_text): >>> replace('--textmode %?a?-u %a? %f', 'a', '') '--textmode %f' """ - if replacement_text == None: + if replacement_text is None: replacement_text = "" regexp = re.compile('%[?]'+format_char+'[?]([^?]*)[?]') if len(replacement_text) > 0: @@ -238,7 +238,7 @@ def flatten(msg, to_unicode=False): """ Produce flat text output from an email Message instance. """ - assert msg != None + assert msg is not None fp = StringIO() g = Generator(fp, mangle_from_=False) g.flatten(msg) @@ -392,9 +392,9 @@ class PGPMimeMessageFactory (object): body.add_header('Content-Disposition', 'inline') return body def passphrase_arg(self, passphrase=None): - if passphrase == None and PASSPHRASE != None: + if passphrase is None and PASSPHRASE is not None: passphrase = PASSPHRASE - if passphrase == None: + if passphrase is None: return (None,'') return (passphrase, pgp_stdin_passphrase_arg) def plain(self): @@ -415,7 +415,7 @@ class PGPMimeMessageFactory (object): bfile.flush() args = replace(pgp_sign_command, 'f', bfile.name) - if PGP_SIGN_AS == None: + if PGP_SIGN_AS is None: pgp_sign_as = '<%s>' % source_email(header) else: pgp_sign_as = PGP_SIGN_AS @@ -453,7 +453,7 @@ class PGPMimeMessageFactory (object): recipient_string = ' '.join(recipients) args = replace(pgp_encrypt_only_command, 'R', recipient_string) args = replace(args, 'f', bfile.name) - if PGP_SIGN_AS == None: + if PGP_SIGN_AS is None: pgp_sign_as = '<%s>' % source_email(header) else: pgp_sign_as = PGP_SIGN_AS @@ -493,7 +493,7 @@ class PGPMimeMessageFactory (object): recipient_string = ' '.join(recipients) args = replace(pgp_encrypt_only_command, 'R', recipient_string) args = replace(args, 'f', bfile.name) - if PGP_SIGN_AS == None: + if PGP_SIGN_AS is None: pgp_sign_as = '<%s>' % source_email(header) else: pgp_sign_as = PGP_SIGN_AS @@ -556,9 +556,9 @@ if __name__ == '__main__': stdin_used = False - if options.passphrase_file != None: + if options.passphrase_file is not None: PASSPHRASE = file(options.passphrase_file, 'r').read() - elif options.passphrase_fd != None: + elif options.passphrase_fd is not None: if options.passphrase_fd == 0: stdin_used = True PASSPHRASE = sys.stdin.read() @@ -573,25 +573,25 @@ if __name__ == '__main__': sys.exit(0) header = None - if options.header_filename != None: + if options.header_filename is not None: if options.header_filename == '-': assert stdin_used == False stdin_used = True header = sys.stdin.read() else: header = file(options.header_filename, 'r').read() - if header == None: + if header is None: raise Exception("missing header") headermsg = header_from_text(header) body = None - if options.body_filename != None: + if options.body_filename is not None: if options.body_filename == '-': assert stdin_used == False stdin_used = True body = sys.stdin.read() else: body = file(options.body_filename, 'r').read() - if body == None: + if body is None: raise Exception("missing body") m = PGPMimeMessageFactory(body) |