summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Bicking <ian@ianbicking.org>2005-08-22 20:51:44 +0000
committerIan Bicking <ian@ianbicking.org>2005-08-22 20:51:44 +0000
commit4d9e1d7d810ec8c35663d0cc689df59ddb58168d (patch)
tree0fe4bda5505034119aa1577ce430e7b6822d150d
parentc15e86febea790a2b9da8163dd16a873ca4423c5 (diff)
downloadpaste-git-4d9e1d7d810ec8c35663d0cc689df59ddb58168d.tar.gz
Converted cgiapp to paste.deploy
-rw-r--r--paste/cgiapp.py14
-rw-r--r--setup.py3
2 files changed, 12 insertions, 5 deletions
diff --git a/paste/cgiapp.py b/paste/cgiapp.py
index ff98452..b1f1077 100644
--- a/paste/cgiapp.py
+++ b/paste/cgiapp.py
@@ -4,6 +4,7 @@ Application that runs a CGI script.
import os
import subprocess
import select
+from paste.deploy import converters
__all__ = ['CGIError', 'CGIApplication']
@@ -19,15 +20,18 @@ class CGIApplication(object):
a path, then ``$PATH`` will be used.
"""
- def __init__(self, script, path=None,
+ def __init__(self, global_conf,
+ script,
+ path=None,
include_os_environ=True,
query_string=None):
self.script_filename = script
- if isinstance(path, (str, unicode)):
- path = [path]
+ if path is None:
+ path = (global_conf.get('path')
+ or global_conf.get('PATH'))
if path is None:
path = os.environ.get('PATH', '').split(':')
- self.path = path
+ self.path = converters.aslist(path, ':')
if '?' in script:
assert query_string is None, (
"You cannot have '?' in your script name (%r) and also "
@@ -45,7 +49,7 @@ class CGIApplication(object):
% (script, self.path))
else:
self.script = script
- self.include_os_environ = include_os_environ
+ self.include_os_environ = converters.asbool(include_os_environ)
self.query_string = query_string
def __call__(self, environ, start_response):
diff --git a/setup.py b/setup.py
index 1d3e294..d2d80d3 100644
--- a/setup.py
+++ b/setup.py
@@ -45,6 +45,9 @@ functionality.
},
zip_safe=False,
entry_points={
+ 'paste.app_factory1': """
+ cgi=paste.cgiapp:CGIApplication
+ """,
'paste.filter_app_factory1': """
error_catcher=paste.exceptions.errormiddleware:ErrorMiddleware
""",