diff options
author | Ian Bicking <ian@ianbicking.org> | 2005-08-22 22:20:26 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2005-08-22 22:20:26 +0000 |
commit | f23fe694cb45b84ab4f7ef5fc49d8f3b6bf2acb0 (patch) | |
tree | d5c95a0d3def5d502547d1b1a8c15e04e7e8aeaa /paste/servers/cgi_server.py | |
parent | d7fe7799d3c0299cfddd4f2f73fcec1558eae19a (diff) | |
download | paste-git-f23fe694cb45b84ab4f7ef5fc49d8f3b6bf2acb0.tar.gz |
Removed things that are either defunct (frameworks, server glue) or will move to a separate package (app_templates)
Diffstat (limited to 'paste/servers/cgi_server.py')
-rw-r--r-- | paste/servers/cgi_server.py | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/paste/servers/cgi_server.py b/paste/servers/cgi_server.py deleted file mode 100644 index bd402bf..0000000 --- a/paste/servers/cgi_server.py +++ /dev/null @@ -1,65 +0,0 @@ -import os -import sys -import commands -from paste import server - -def serve(conf, app): - replacements = {} - replacements['default_config_fn'] = os.path.abspath( - server.default_config_fn) - - # Ideally, other_conf should be any options that came from the - # command-line. - # @@: This assumes too much about the ordering of namespaces. - other_conf = dict(conf.namespaces[-2]) - # Not a good idea to let 'verbose' through, but this doesn't really - # stop any sourced configs from setting it either... - if other_conf.has_key('verbose'): - del other_conf['verbose'] - replacements['other_conf'] = other_conf - replacements['extra_sys_path'] = find_extra_sys_path() - - template_fn = os.path.join(os.path.dirname(__file__), - 'server_script_template.py.txt') - template = open(template_fn).read() - for name, value in replacements.items(): - template = template.replace('@@' + name + '@@', repr(value)) - - print "#!%s" % sys.executable - print template - print "if __name__ == '__main__':" - print " from paste.servers.cgi_wsgi import run_with_cgi" - print " run_with_cgi(app, redirect_stdout=True)" - -description = """\ -A 'server' that creates a CGI script that you can use to invoke your -application. -""" - -help = """\ -Typically you would use this like: - - %prog --server=cgi > .../cgi-bin/myapp.cgi - chmod +x .../cgi-bin/myapp.cgi -""" - -def find_extra_sys_path(): - """ - Tries to find all the items on sys.path that wouldn't be there - normally. - """ - args = [sys.executable, "-c", "import sys; print sys.path"] - old_keys = {} - for key, value in os.environ.items(): - if key.startswith('PYTHON'): - old_keys[key] = value - del os.environ[key] - result = commands.getoutput('%s -c "import sys; print sys.path"' - % sys.executable) - os.environ.update(old_keys) - bare_sys_path = eval(result) - extra = [path for path in sys.path - if path not in bare_sys_path] - return extra - - |