]> git.phdru.name Git - mimedecode.git/blobdiff - mimedecode.py
Minor refactoring
[mimedecode.git] / mimedecode.py
index 84fe0c05305e13b1a7198f6259d10d7631270ad5..d6930b7e02e25d6eab3e31960911c67c5a267b2a 100755 (executable)
@@ -2,13 +2,7 @@
 """Decode MIME message"""
 
 
-_version = "2.1.0"
-__version__ = "$Revision$"[11:-2]
-__revision__ = "$Id$"[5:-2]
-__date__ = "$Date$"[7:-2]
-__author__ = "Oleg Broytman <phd@phd.pp.ru>"
-__copyright__ = "Copyright (C) 2001-2009 PhiloSoft Design"
-__license__ = "GNU GPL"
+from mimedecode_version import __version__, __author__, __copyright__, __license__
 
 
 import sys, os
@@ -29,7 +23,7 @@ me = os.path.basename(sys.argv[0])
 def version(exit=1):
    sys.stdout.write("""\
 Broytman mimedecode.py version %s, %s
-""" % (_version, __copyright__))
+""" % (__version__, __copyright__))
    if exit: sys.exit(0)
 
 
@@ -41,10 +35,10 @@ Usage: %s [-h|--help] [-V|--version] [-cCDP] [-f charset] [-d header] [-p header
    sys.exit(code)
 
 
-def output(s, outfile = sys.stdout):
+def output(s, outfile=sys.stdout):
    outfile.write(s)
 
-def output_headers(msg, outfile = sys.stdout):
+def output_headers(msg, outfile=sys.stdout):
    unix_from = msg.get_unixfrom()
    if unix_from:
       output(unix_from + os.linesep)
@@ -294,9 +288,10 @@ class GlobalOptions:
    from m_lib.defenc import default_encoding
    recode_charset = 1 # recode charset of message body
 
-   decode_headers = ["Subject", "From"] # A list of headers to decode
-   decode_header_params = [("Content-Type", "name"),
-      ("Content-Disposition", "filename")
+   decode_headers = ["From", "Subject"] # A list of headers to decode
+   decode_header_params = [
+      ("Content-Type", "name"),
+      ("Content-Disposition", "filename"),
    ] # A list of headers' parameters to decode
 
    totext_mask = [] # A list of content-types to decode