cgi dectection
Michal Wallace
sabren at manifestation.com
Thu Jul 27 11:46:47 EDT 2000
On Fri, 28 Jul 2000, Michael Lunnay wrote:
> is there a standard way to detect if script is being run as a cgi script or
> from the command line. I am creating a script that can be run from both and
> obviously want the cgi to output HTML but the cammnd line to print text.
A couple ways to get what you want come to mind:
1. check for CGI-specific variables in os.environ, eg CONTENT_TYPE
2. make the core logic into a module, and then have two front ends. :)
3. check for a command line flag if you want text..
Cheers,
- Michal
------------------------------------------------------------------------
www.manifestation.com www.sabren.com www.linkwatcher.com www.zike.net
------------------------------------------------------------------------
More information about the Python-list
mailing list