| OLD | NEW |
| 1 #! /usr/local/bin/python | 1 #! /usr/local/bin/python |
| 2 | 2 |
| 3 # NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is | 3 # NOTE: the above "/usr/local/bin/python" is NOT a mistake. It is |
| 4 # intentionally NOT "/usr/bin/env python". On many systems | 4 # intentionally NOT "/usr/bin/env python". On many systems |
| 5 # (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI | 5 # (e.g. Solaris), /usr/local/bin is not in $PATH as passed to CGI |
| 6 # scripts, and /usr/local/bin is the default directory where Python is | 6 # scripts, and /usr/local/bin is the default directory where Python is |
| 7 # installed, so /usr/bin/env would be unable to find python. Granted, | 7 # installed, so /usr/bin/env would be unable to find python. Granted, |
| 8 # binary installations by Linux vendors often install Python in | 8 # binary installations by Linux vendors often install Python in |
| 9 # /usr/bin. So let those vendors patch cgi.py to match their choice | 9 # /usr/bin. So let those vendors patch cgi.py to match their choice |
| 10 # of installation. | 10 # of installation. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 | 33 |
| 34 # Imports | 34 # Imports |
| 35 # ======= | 35 # ======= |
| 36 | 36 |
| 37 from operator import attrgetter | 37 from operator import attrgetter |
| 38 import sys | 38 import sys |
| 39 import os | 39 import os |
| 40 import urllib | 40 import urllib |
| 41 import UserDict | 41 import UserDict |
| 42 from test.test_support import catch_warning | 42 from warnings import filterwarnings, catch_warnings |
| 43 from warnings import filterwarnings | 43 with catch_warnings(): |
| 44 with catch_warning(record=False): | 44 if sys.py3kwarning: |
| 45 filterwarnings("ignore", ".*mimetools has been removed", | 45 filterwarnings("ignore", ".*mimetools has been removed", |
| 46 DeprecationWarning) | 46 DeprecationWarning) |
| 47 import mimetools | 47 import mimetools |
| 48 filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning) | 48 if sys.py3kwarning: |
| 49 filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning
) |
| 49 import rfc822 | 50 import rfc822 |
| 50 | 51 |
| 51 try: | 52 try: |
| 52 from cStringIO import StringIO | 53 from cStringIO import StringIO |
| 53 except ImportError: | 54 except ImportError: |
| 54 from StringIO import StringIO | 55 from StringIO import StringIO |
| 55 | 56 |
| 56 __all__ = ["MiniFieldStorage", "FieldStorage", "FormContentDict", | 57 __all__ = ["MiniFieldStorage", "FieldStorage", "FormContentDict", |
| 57 "SvFormContentDict", "InterpFormContentDict", "FormContent", | 58 "SvFormContentDict", "InterpFormContentDict", "FormContent", |
| 58 "parse", "parse_qs", "parse_qsl", "parse_multipart", | 59 "parse", "parse_qs", "parse_qsl", "parse_multipart", |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1078 def valid_boundary(s, _vb_pattern="^[ -~]{0,200}[!-~]$"): | 1079 def valid_boundary(s, _vb_pattern="^[ -~]{0,200}[!-~]$"): |
| 1079 import re | 1080 import re |
| 1080 return re.match(_vb_pattern, s) | 1081 return re.match(_vb_pattern, s) |
| 1081 | 1082 |
| 1082 # Invoke mainline | 1083 # Invoke mainline |
| 1083 # =============== | 1084 # =============== |
| 1084 | 1085 |
| 1085 # Call test() when this file is run as a script (not imported as a module) | 1086 # Call test() when this file is run as a script (not imported as a module) |
| 1086 if __name__ == '__main__': | 1087 if __name__ == '__main__': |
| 1087 test() | 1088 test() |
| OLD | NEW |