Staging
v0.5.1
https://github.com/python/cpython
Revision 36f7e938f287adb4a5c00bb66c5479357dfa9c26 authored by Tim Peters on 23 July 2003, 00:05:07 UTC, committed by Tim Peters on 23 July 2003, 00:05:07 UTC
Obtain the original locale in the documented way.  This way actually
works for me.

Restore the original locale at the end, instead of forcing to "C".

Move the locale fiddling into the test driver instead of doing it as a
side effect of merely importing the module.  I don't know why the test
is mucking with locale (and also added a comment saying so), but it
surely has no justification for doing that as an import side-effect.
Now whenever the locale-changing code executes, the locale-restoring code
will also get run.
1 parent d1deac0
Raw File
Tip revision: 36f7e938f287adb4a5c00bb66c5479357dfa9c26 authored by Tim Peters on 23 July 2003, 00:05:07 UTC
Fred wasn't kidding -- there really are docs for the locale module <wink>.
Tip revision: 36f7e93
cgi1.py
#!/usr/local/bin/python

"""CGI test 1 - check server setup."""

# Until you get this to work, your web server isn't set up right or
# your Python isn't set up right.

# If cgi0.sh works but cgi1.py doesn't, check the #! line and the file
# permissions.  The docs for the cgi.py module have debugging tips.

print "Content-type: text/html"
print
print "<h1>Hello world</h1>"
print "<p>This is cgi1.py"
back to top