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 | |
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)
47 files changed, 0 insertions, 1072 deletions
diff --git a/paste/app_templates/__init__.py b/paste/app_templates/__init__.py deleted file mode 100644 index 792d600..0000000 --- a/paste/app_templates/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/paste/app_templates/default_tmpl.py b/paste/app_templates/default_tmpl.py deleted file mode 100644 index f65c1f3..0000000 --- a/paste/app_templates/default_tmpl.py +++ /dev/null @@ -1,4 +0,0 @@ -from paste import app_setup - -the_runner = app_setup.CommandRunner() -run = the_runner.run diff --git a/paste/app_templates/wareweb_zpt_tmpl/__init__.py b/paste/app_templates/wareweb_zpt_tmpl/__init__.py deleted file mode 100644 index dff1b60..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/__init__.py +++ /dev/null @@ -1,43 +0,0 @@ -import os -from paste import app_setup -from paste import pyconfig - -the_runner = app_setup.CommandRunner() -the_runner.register(app_setup.CommandCreate) - -class CommandServlet(app_setup.Command): - - name = 'servlet' - summary = 'Create a new servlet and template' - max_args = 1 - min_args = 1 - - parser = app_setup.standard_parser() - - def command(self): - servlet_fn = os.path.splitext(self.args[0])[0] - config = {} - if '/' in servlet_fn or '\\' in servlet_fn: - servlet_name = os.path.basename(servlet_fn) - else: - servlet_name = servlet_fn - if self.runner.server_conf_fn: - output_dir = os.path.dirname(self.runner.server_conf_fn) - config = pyconfig.Config() - config.load(self.runner.server_conf_fn) - else: - output_dir = os.getcwd() - source_dir = os.path.join(self.template_dir, 'servlet_template') - template_options = config.copy() - template_options.update(self.options.__dict__) - template_options.update({ - 'servlet_name': servlet_name, - 'servlet_fn': servlet_fn, - }) - app_setup.copy_dir( - source_dir, output_dir, template_options, - self.options.verbose, self.options.simulate) - -the_runner.register(CommandServlet) - -run = the_runner.run diff --git a/paste/app_templates/wareweb_zpt_tmpl/description.txt b/paste/app_templates/wareweb_zpt_tmpl/description.txt deleted file mode 100644 index c28a3d5..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/description.txt +++ /dev/null @@ -1,4 +0,0 @@ -Wareweb and Zope Page Template framework - -This sets up a basic Wareweb application, using Zope Page Templates -(with ZPTKit). diff --git a/paste/app_templates/wareweb_zpt_tmpl/servlet_template/templates/+servlet_name+.pt b/paste/app_templates/wareweb_zpt_tmpl/servlet_template/templates/+servlet_name+.pt deleted file mode 100644 index e2825e5..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/servlet_template/templates/+servlet_name+.pt +++ /dev/null @@ -1,7 +0,0 @@ -<html metal:use-macro="here/standard_template.pt/macros/page"> -<metal:body fill-slot="body"> - - - -</metal:body> -</html>
\ No newline at end of file diff --git a/paste/app_templates/wareweb_zpt_tmpl/servlet_template/web/+servlet_name+.py_tmpl b/paste/app_templates/wareweb_zpt_tmpl/servlet_template/web/+servlet_name+.py_tmpl deleted file mode 100644 index ee94338..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/servlet_template/web/+servlet_name+.py_tmpl +++ /dev/null @@ -1,7 +0,0 @@ -from $app_name.sitepage import SitePage - -class $servlet_name(SitePage): - - def setup(self): - self.title = $str_servlet_name - diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/__init__.py_tmpl b/paste/app_templates/wareweb_zpt_tmpl/template/__init__.py_tmpl deleted file mode 100644 index 1cb2d1b..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/__init__.py_tmpl +++ /dev/null @@ -1,4 +0,0 @@ -from paste.util.thirdparty import add_package - -add_package('ZopePageTemplates') -add_package('ZPTKit') diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/server.conf b/paste/app_templates/wareweb_zpt_tmpl/template/server.conf deleted file mode 100644 index 463cff9..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/server.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -*- python -*- Note: this file is in Python syntax - -import os - -app_template = $str_template_name -app_name = $str_app_name -framework = 'wareweb' -root_path = $str_absolute_base_dir -publish_dir = os.path.join(root_path, 'web') -sys_path = [os.path.dirname(root_path)] - -## Server options: - -verbose = $bool_verbose -# The name of the server-type to start: -server = $str_server -# If true, files will be regularly polled and the server restarted -# if files are modified: -reload = $bool_reload -# If true, tracebacks will be shown in the browser: -debug = $bool_debug diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/sitepage.py_tmpl b/paste/app_templates/wareweb_zpt_tmpl/template/sitepage.py_tmpl deleted file mode 100644 index fad80d9..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/sitepage.py_tmpl +++ /dev/null @@ -1,13 +0,0 @@ -from paste.wareweb import * -from ZPTKit.zptwareweb import ZPTComponent - -class SitePage(Servlet): - - message = Notify() - template = ZPTComponent() - app_name = $str_app_name - -# This protects "from sitepage import *", since we will no longer -# need these variables: -del ZPTComponent -del Notify diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/templates/generic_error.pt b/paste/app_templates/wareweb_zpt_tmpl/template/templates/generic_error.pt deleted file mode 100644 index 7b32820..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/templates/generic_error.pt +++ /dev/null @@ -1,7 +0,0 @@ -<html metal:use-macro="here/standard_template.pt/macros/page"> -<metal:body fill-slot="body"> - -<tal:block replace="structure options/error_message" /> - -</metal:body> -</html>
\ No newline at end of file diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/templates/index.pt b/paste/app_templates/wareweb_zpt_tmpl/template/templates/index.pt deleted file mode 100644 index ff16ada..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/templates/index.pt +++ /dev/null @@ -1,22 +0,0 @@ -<html metal:use-macro="here/standard_template.pt/macros/page"> -<metal:body fill-slot="body"> - -<p> -Congratulations, you have set up your new application instance. -This page serves as an example; feel free to overwrite it. -</p> - -<p> -These are all the environmental variables defined: -</p> - -<table border=1> - <tr tal:repeat="var options/vars"> - <td tal:content="python: var[0]">Var Name</td> - <td><tt tal:content="python: var[1]">Var value</tt></td> - </tr> -</table> - - -</metal:body> -</html>
\ No newline at end of file diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/templates/standard_template.pt b/paste/app_templates/wareweb_zpt_tmpl/template/templates/standard_template.pt deleted file mode 100644 index b35ec74..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/templates/standard_template.pt +++ /dev/null @@ -1,31 +0,0 @@ -<metal:tpl define-macro="page"> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html lang="en-US"> -<head> -<title tal:content="servlet/title">title</title> -<link rel="stylesheet" type="text/css" - tal:attributes="href python: servlet.app_static_url + '/stylesheet.css'"> - -<metal:slot define-slot="extra_head"></metal:slot> - -</head> -<body> - -<h1><tal:mark replace="servlet/title"/></h1> - -<div class="notifyMessage" - tal:condition="servlet/message" - tal:content="structure servlet/message/html"> - [This is where the notification messages go] -</div> - -<div id="content"> -<metal:tpl define-slot="body"> -[This page has not customized its "body" slot] -</metal:tpl> -</div> - -</body> -</html> -</metal:tpl> diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/web/__init__.py_tmpl b/paste/app_templates/wareweb_zpt_tmpl/template/web/__init__.py_tmpl deleted file mode 100644 index 1454f37..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/web/__init__.py_tmpl +++ /dev/null @@ -1,6 +0,0 @@ -import os -from paste import wsgilib - -def urlparser_hook(environ): - if not environ.has_key('${app_name}.base_url'): - environ['${app_name}.base_url'] = environ['SCRIPT_NAME'] diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/web/index.py_tmpl b/paste/app_templates/wareweb_zpt_tmpl/template/web/index.py_tmpl deleted file mode 100644 index 6144e17..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/web/index.py_tmpl +++ /dev/null @@ -1,9 +0,0 @@ -from $app_name.sitepage import SitePage - -class index(SitePage): - - def setup(self): - self.options.vars = self.environ.items() - self.options.vars.sort() - self.title = 'Welcome to your new app' - diff --git a/paste/app_templates/wareweb_zpt_tmpl/template/web/static/stylesheet.css b/paste/app_templates/wareweb_zpt_tmpl/template/web/static/stylesheet.css deleted file mode 100644 index d70e9ec..0000000 --- a/paste/app_templates/wareweb_zpt_tmpl/template/web/static/stylesheet.css +++ /dev/null @@ -1,13 +0,0 @@ -body { - font-family: Helvetica, Arial, sans-serif; -} - -pre { - overflow: auto; -} - -div.notifyMessage { - border: 2px solid black; - background-color: #007700; - color: #ffffff; -} diff --git a/paste/app_templates/webkit_zpt_tmpl/__init__.py b/paste/app_templates/webkit_zpt_tmpl/__init__.py deleted file mode 100644 index d5275a4..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/__init__.py +++ /dev/null @@ -1,45 +0,0 @@ -import os -from paste import app_setup -from paste import pyconfig - -the_runner = app_setup.CommandRunner() -the_runner.register(app_setup.CommandCreate) - -class CommandServlet(app_setup.Command): - - name = 'servlet' - summary = 'Create a new servlet and template' - max_args = 1 - min_args = 1 - - parser = app_setup.standard_parser() - - def command(self): - servlet_fn = os.path.splitext(self.args[0])[0] - config = {} - if '/' in servlet_fn or '\\' in servlet_fn: - servlet_name = os.path.basename(servlet_fn) - else: - servlet_name = servlet_fn - if self.runner.server_conf_fn: - config = pyconfig.Config(with_default=True) - config.load(self.runner.server_conf_fn) - output_dir = config.get('base_dir') - if output_dir is None: - output_dir = os.path.dirname(self.runner.server_conf_fn) - else: - output_dir = os.getcwd() - source_dir = os.path.join(self.template_dir, 'servlet_template') - template_options = config.copy() - template_options.update(self.options.__dict__) - template_options.update({ - 'servlet_name': servlet_name, - 'servlet_fn': servlet_fn, - }) - app_setup.copy_dir( - source_dir, output_dir, template_options, - self.options.verbose, self.options.simulate) - -the_runner.register(CommandServlet) - -run = the_runner.run diff --git a/paste/app_templates/webkit_zpt_tmpl/description.txt b/paste/app_templates/webkit_zpt_tmpl/description.txt deleted file mode 100644 index 5385771..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/description.txt +++ /dev/null @@ -1,4 +0,0 @@ -WebKit and Zope Page Template framework - -This sets up a basic Webware/WebKit application, using Zope Page -Templates, Webware Components, and ZPTKit. diff --git a/paste/app_templates/webkit_zpt_tmpl/servlet_template/templates/+servlet_name+.pt b/paste/app_templates/webkit_zpt_tmpl/servlet_template/templates/+servlet_name+.pt deleted file mode 100644 index e2825e5..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/servlet_template/templates/+servlet_name+.pt +++ /dev/null @@ -1,7 +0,0 @@ -<html metal:use-macro="here/standard_template.pt/macros/page"> -<metal:body fill-slot="body"> - - - -</metal:body> -</html>
\ No newline at end of file diff --git a/paste/app_templates/webkit_zpt_tmpl/servlet_template/web/+servlet_name+.py_tmpl b/paste/app_templates/webkit_zpt_tmpl/servlet_template/web/+servlet_name+.py_tmpl deleted file mode 100644 index 52ae6f9..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/servlet_template/web/+servlet_name+.py_tmpl +++ /dev/null @@ -1,7 +0,0 @@ -from $app_name.sitepage import SitePage - -class $servlet_name(SitePage): - - def setup(self): - self.options.title = $str_servlet_name - diff --git a/paste/app_templates/webkit_zpt_tmpl/template/__init__.py_tmpl b/paste/app_templates/webkit_zpt_tmpl/template/__init__.py_tmpl deleted file mode 100644 index 0454673..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/__init__.py_tmpl +++ /dev/null @@ -1,5 +0,0 @@ -from paste.util.thirdparty import add_package - -add_package('ZopePageTemplates') -add_package('Component') -add_package('ZPTKit') diff --git a/paste/app_templates/webkit_zpt_tmpl/template/server.conf b/paste/app_templates/webkit_zpt_tmpl/template/server.conf deleted file mode 100644 index a6b9554..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/server.conf +++ /dev/null @@ -1,24 +0,0 @@ -# -*- python -*- Note: this file is in Python syntax - -import os - -app_template = $str_template_name -app_name = $str_app_name -framework = 'webkit' -base_path = os.path.dirname(__file__) -publish_dir = os.path.join(base_path, 'web') -sys_path = [os.path.dirname(here)] - -## Server options: - -verbose = $bool_verbose -# The name of the server-type to start: -server = $str_server -# If true, files will be regularly polled and the server restarted -# if files are modified: -reload = $bool_reload -# If true, tracebacks will be shown in the browser: -debug = $bool_debug - -show_exceptions_in_error_log = False - diff --git a/paste/app_templates/webkit_zpt_tmpl/template/sitepage.py_tmpl b/paste/app_templates/webkit_zpt_tmpl/template/sitepage.py_tmpl deleted file mode 100644 index 7ab073c..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/sitepage.py_tmpl +++ /dev/null @@ -1,33 +0,0 @@ -import os -from Component import CPage -from Component.notify import NotifyComponent -from ZPTKit import ZPTComponent - -class SitePage(CPage): - - components = [ - ZPTComponent([os.path.join(os.path.dirname(__file__), - 'templates')]), - NotifyComponent()] - - def title(self): - return self.options.get('title', CPage.title(self)) - - def awake(self, trans): - CPage.awake(self, trans) - self.baseURL = self.request().environ()['$app_name.base_url'] - self.baseStaticURL = self.baseURL + '/static' - self.setup() - - def setup(self): - pass - - def sleep(self, trans): - self.teardown() - CPage.sleep(self, trans) - - def teardown(self): - pass - - def writeHTML(self): - self.writeTemplate() diff --git a/paste/app_templates/webkit_zpt_tmpl/template/templates/generic_error.pt b/paste/app_templates/webkit_zpt_tmpl/template/templates/generic_error.pt deleted file mode 100644 index 7b32820..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/templates/generic_error.pt +++ /dev/null @@ -1,7 +0,0 @@ -<html metal:use-macro="here/standard_template.pt/macros/page"> -<metal:body fill-slot="body"> - -<tal:block replace="structure options/error_message" /> - -</metal:body> -</html>
\ No newline at end of file diff --git a/paste/app_templates/webkit_zpt_tmpl/template/templates/index.pt b/paste/app_templates/webkit_zpt_tmpl/template/templates/index.pt deleted file mode 100644 index ff16ada..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/templates/index.pt +++ /dev/null @@ -1,22 +0,0 @@ -<html metal:use-macro="here/standard_template.pt/macros/page"> -<metal:body fill-slot="body"> - -<p> -Congratulations, you have set up your new application instance. -This page serves as an example; feel free to overwrite it. -</p> - -<p> -These are all the environmental variables defined: -</p> - -<table border=1> - <tr tal:repeat="var options/vars"> - <td tal:content="python: var[0]">Var Name</td> - <td><tt tal:content="python: var[1]">Var value</tt></td> - </tr> -</table> - - -</metal:body> -</html>
\ No newline at end of file diff --git a/paste/app_templates/webkit_zpt_tmpl/template/templates/standard_template.pt b/paste/app_templates/webkit_zpt_tmpl/template/templates/standard_template.pt deleted file mode 100644 index 4e75a5c..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/templates/standard_template.pt +++ /dev/null @@ -1,29 +0,0 @@ -<metal:tpl define-macro="page"> -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" - "http://www.w3.org/TR/REC-html40/loose.dtd"> -<html lang="en-US"> -<head> -<title tal:content="servlet/title">title</title> -<link rel="stylesheet" type="text/css" - tal:attributes="href python: servlet.baseStaticURL + '/stylesheet.css'"> - -<metal:slot define-slot="extra_head"></metal:slot> - -</head> -<body> - -<h1><tal:mark replace="servlet/title"/></h1> - -<span tal:replace="structure servlet/messageText"> -This is where the notification messages go. -</span> - -<div id="content"> -<metal:tpl define-slot="body"> -[This page has not customized its "body" slot] -</metal:tpl> -</div> - -</body> -</html> -</metal:tpl> diff --git a/paste/app_templates/webkit_zpt_tmpl/template/web/__init__.py_tmpl b/paste/app_templates/webkit_zpt_tmpl/template/web/__init__.py_tmpl deleted file mode 100644 index 1454f37..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/web/__init__.py_tmpl +++ /dev/null @@ -1,6 +0,0 @@ -import os -from paste import wsgilib - -def urlparser_hook(environ): - if not environ.has_key('${app_name}.base_url'): - environ['${app_name}.base_url'] = environ['SCRIPT_NAME'] diff --git a/paste/app_templates/webkit_zpt_tmpl/template/web/index.py_tmpl b/paste/app_templates/webkit_zpt_tmpl/template/web/index.py_tmpl deleted file mode 100644 index e095943..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/web/index.py_tmpl +++ /dev/null @@ -1,9 +0,0 @@ -from $app_name.sitepage import SitePage - -class index(SitePage): - - def setup(self): - self.options.vars = self.request().environ().items() - self.options.vars.sort() - self.options.title = 'Welcome to your new app' - diff --git a/paste/app_templates/webkit_zpt_tmpl/template/web/static/stylesheet.css b/paste/app_templates/webkit_zpt_tmpl/template/web/static/stylesheet.css deleted file mode 100644 index d70e9ec..0000000 --- a/paste/app_templates/webkit_zpt_tmpl/template/web/static/stylesheet.css +++ /dev/null @@ -1,13 +0,0 @@ -body { - font-family: Helvetica, Arial, sans-serif; -} - -pre { - overflow: auto; -} - -div.notifyMessage { - border: 2px solid black; - background-color: #007700; - color: #ffffff; -} diff --git a/paste/frameworks/__init__.py b/paste/frameworks/__init__.py deleted file mode 100644 index 792d600..0000000 --- a/paste/frameworks/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/paste/frameworks/default_framework.py b/paste/frameworks/default_framework.py deleted file mode 100644 index 5f94ac6..0000000 --- a/paste/frameworks/default_framework.py +++ /dev/null @@ -1,24 +0,0 @@ -import sys -from paste import makeapp - -def build_application(conf): - if conf.get('publish_dir'): - from paste.webkit import conf_setup - app = conf_setup.build_application(conf) - elif conf.get('publish_app'): - app = conf['publish_app'] - if isinstance(app, (str, unicode)): - from paste.util import import_string - app = import_string.eval_import(app) - app = makeapp.apply_conf_middleware(app, conf) - app = makeapp.apply_default_middleware(app, conf) - elif conf.get('system_urlmap'): - app = None - else: - # @@ ianb 2005-03-23: This should be removed sometime - if conf.get('webkit_dir'): - print 'The webkit_dir configuration variable is no longer supported' - print 'Use publish_dir instead' - print "You must provide publish_dir or publish_app" - sys.exit(2) - return app diff --git a/paste/frameworks/wareweb_framework.txt b/paste/frameworks/wareweb_framework.txt deleted file mode 100644 index fde9485..0000000 --- a/paste/frameworks/wareweb_framework.txt +++ /dev/null @@ -1 +0,0 @@ -paste.wareweb.conf_setup diff --git a/paste/frameworks/webkit_framework.txt b/paste/frameworks/webkit_framework.txt deleted file mode 100644 index 93beb1d..0000000 --- a/paste/frameworks/webkit_framework.txt +++ /dev/null @@ -1 +0,0 @@ -paste.webkit.conf_setup diff --git a/paste/servers/README.txt b/paste/servers/README.txt deleted file mode 100644 index 7b91d24..0000000 --- a/paste/servers/README.txt +++ /dev/null @@ -1,24 +0,0 @@ -This directory contains plugins for servers. Each plugin is -identified by having "_server" on the end of its name. Plugins can be -directories (Python packages), Python modules, or text (.txt) files. - -A text file must contain one (non-empty, non-comment) line, which is -the name of a module that should be considered a server. E.g., you'd -put "myapp.my_paste_server" in there, so that you could implement a -server in your own package. - -Modules should have certain symbols (only 'serve' is required): - -serve(conf, app): - Required; this serves the given application, using the given - configuration options. -options: - A list of (option_name, option_help), describing the options this - servers uses. -description: - A fairly short (2-3 line) description of this server. -help: - A longer help text. - -Note: if you have a package, __init__.py must contain these -variables.
\ No newline at end of file diff --git a/paste/servers/__init__.py b/paste/servers/__init__.py deleted file mode 100644 index 792d600..0000000 --- a/paste/servers/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# diff --git a/paste/servers/ajp_fork_server.py b/paste/servers/ajp_fork_server.py deleted file mode 100644 index 469fce7..0000000 --- a/paste/servers/ajp_fork_server.py +++ /dev/null @@ -1,12 +0,0 @@ -from ajp_threaded_server import * - -def serve(conf, app): - from flup.server.ajp_fork import WSGIServer - return serve_server(conf, app, WSGIServer) - -description = """\ -An AJP (Apache Jarkarta Tomcat Connector) forking (multiprocess) -server. For more about AJP see -<http://jakarta.apache.org/tomcat/connectors-doc/>. This server is -from flup <http://www.saddi.com/software/flup/> -""" diff --git a/paste/servers/ajp_threaded_server.py b/paste/servers/ajp_threaded_server.py deleted file mode 100644 index 8bdedc7..0000000 --- a/paste/servers/ajp_threaded_server.py +++ /dev/null @@ -1,60 +0,0 @@ -from optparse import Option -from paste.util import thirdparty -thirdparty.add_package('flup') -from paste import pyconfig - -def serve(conf, app): - from flup.server.ajp import WSGIServer - return serve_server(conf, app, WSGIServer) - -def serve_server(conf, app, server_class): - root_url = conf.get('root_url', '') - root_url = root_url and root_url.rstrip('/') - server = server_class( - app, - scriptName=root_url, - bindAddress=(conf.get('host', 'localhost'), - int(conf.get('port', 8009))), - allowedServers=pyconfig.make_list(conf.get('allowed_servers', None))) - return server.run() - -options = [ - Option('--host', - metavar="HOST", - help='The host name to bind to (default localhost). Note, if binding to localhost, only local connections will be allowed.'), - Option('--port', - metavar="PORT", - help='The port to bind to (default 8009).'), - Option('--root-url', - metavar="URL", - help='The URL level to expect for incoming connections; if not set and this is not bound to /, then SCRIPT_NAME and PATH_INFO may be incorrect.'), - Option('--allowed-servers', - metavar="IP_LIST", - help='A list of servers to allow connections from.'), - ] - -description = """\ -An AJP (Apache Jarkarta Tomcat Connector) threaded server. For more -about AJP see <http://jakarta.apache.org/tomcat/connectors-doc/>. -This server is from flup: <http://www.saddi.com/software/flup/>. -""" - -help = """\ -When configuring, you would set worker.properties to something like -(for mod_jk): - - worker.list=foo - worker.foo.port=8009 - worker.foo.host=localhost - worker.foo.type=ajp13 - -Example httpd.conf (for mod_jk): - - JkWorkersFile /path/to/workers.properties - JkMount /* foo - -If your ajp application is not on the root, you SHOULD specify -root_url so that SCRIPT_NAME and PATH_INFO are correct. -""" - -# @@: TODO: handle the logging level, or integrate logging 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 - - diff --git a/paste/servers/cgi_wsgi.py b/paste/servers/cgi_wsgi.py deleted file mode 100644 index 83d257c..0000000 --- a/paste/servers/cgi_wsgi.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -cgi WSGI server -=============== - -Usage ------ - -The CGI script is the configuration and glue for this server. -Typically you will write a CGI script like:: - - #!/usr/bin/env python - from paste.cgiserver import run_with_cgi - # Assuming app is your WSGI application object... - from myapplication import app - run_with_cgi(app) - -""" - -import os, sys - -def run_with_cgi(application, - use_cgitb=True, - redirect_stdout=False): - stdout = sys.stdout - - if use_cgitb: - import cgitb - cgitb.enable() - - environ = dict(os.environ) - environ['wsgi.input'] = sys.stdin - environ['wsgi.errors'] = sys.stderr - environ['wsgi.version'] = (1, 0) - environ['wsgi.multithread'] = False - environ['wsgi.multiprocess'] = True - environ['wsgi.run_once'] = True - - if os.environ.get('HTTPS', 'off').lower() in ('on', '1'): - environ['wsgi.url_scheme'] = 'https' - else: - environ['wsgi.url_scheme'] = 'http' - - if redirect_stdout: - sys.stdout = sys.stderr - - headers_set = [] - headers_sent = [] - result = None - - def write(data): - assert headers_set, "write() before start_response()" - - if not headers_sent: - # Before the first output, send the stored headers - status, response_headers = headers_sent[:] = headers_set - - # See if Content-Length is given. - found = False - for name, value in response_headers: - if name.lower() == 'content-length': - found = True - break - - # If not given, try to deduce it if the iterator implements - # __len__ and is of length 1. (data will be result[0] in this - # case.) - if not found and result is not None: - try: - if len(result) == 1: - response_headers.append(('Content-Length', - str(len(data)))) - except: - pass - - stdout.write('Status: %s\r\n' % status) - for header in response_headers: - stdout.write('%s: %s\r\n' % header) - stdout.write('\r\n') - - stdout.write(data) - stdout.flush() - - def start_response(status, response_headers, exc_info=None): - if exc_info: - try: - if headers_sent: - # Re-raise original exception if headers sent - raise exc_info[0], exc_info[1], exc_info[2] - finally: - exc_info = None # avoid dangling circular ref - else: - assert not headers_set, "Headers already set!" - - headers_set[:] = [status, response_headers] - return write - - result = application(environ, start_response) - try: - for data in result: - if data: # don't send headers until body appears - write(data) - if not headers_sent: - write('') # send headers now if body was empty - finally: - if hasattr(result, 'close'): - result.close() - -if __name__ == '__main__': - def myapp(environ, start_response): - start_response('200 OK', [('Content-Type', 'text/plain')]) - return ['Hello World!\n'] - - run_with_cgi(myapp) diff --git a/paste/servers/console_server.py b/paste/servers/console_server.py deleted file mode 100644 index 02512a9..0000000 --- a/paste/servers/console_server.py +++ /dev/null @@ -1,43 +0,0 @@ -from paste import wsgilib -from optparse import Option - -def serve(conf, app): - url = conf.get('url', '/') - query_string = '' - if '?' in url: - url, query_string = url.split('?', 1) - quiet = conf.get('quiet', False) - status, headers, content, errors = wsgilib.raw_interactive( - app, url, QUERY_STRING=query_string) - any_header = False - if not quiet or int(status.split()[0]) != 200: - print 'Status:', status - any_header = True - for header, value in headers: - if quiet and ( - header.lower() in ('content-type', 'content-length') - or (header.lower() == 'set-cookie' - and value.startswith('_SID_'))): - continue - print '%s: %s' % (header, value) - any_header = True - if any_header: - print - if conf.get('compact', False): - # Remove empty lines - content = '\n'.join([l for l in content.splitlines() - if l.strip()]) - print content - if errors: - sys.stderr.write('-'*25 + ' Errors ' + '-'*25 + '\n') - sys.stderr.write(errors + '\n') - -description = """\ -Displays a single request to stdout -""" - -options = [ - Option('--url', - metavar='URL', - help="The URL (not including domain or port!) to GET"), - ] diff --git a/paste/servers/fastcgi_fork_server.py b/paste/servers/fastcgi_fork_server.py deleted file mode 100644 index 8d059af..0000000 --- a/paste/servers/fastcgi_fork_server.py +++ /dev/null @@ -1,11 +0,0 @@ -from fastcgi_threaded_server import * - -def serve(conf, app): - from flup.server.fcgi_fork import WSGIServer - return serve_server(conf, app, WSGIServer) - -description = """\ -A FastCGI forking (multiprocess) server. For more information on -FastCGI see <http://www.fastcgi.com>. This server is from flup: -<http://www.saddi.com/software/flup/>. -""" diff --git a/paste/servers/fastcgi_threaded_server.py b/paste/servers/fastcgi_threaded_server.py deleted file mode 100644 index d8857f7..0000000 --- a/paste/servers/fastcgi_threaded_server.py +++ /dev/null @@ -1,48 +0,0 @@ -import os -from optparse import Option -from paste.util import thirdparty -thirdparty.add_package('flup') -from paste import pyconfig - -def serve(conf, app): - from flup.server.fcgi import WSGIServer - return serve_server(conf, app, WSGIServer) - -def serve_server(conf, app, server_class): - if conf.get('host'): - if not conf.get('port'): - raise ValueError( - "There is no default port for FastCGI; if you give 'host' you must provide 'port'") - address = (conf['host'], conf['port']) - elif conf.get('socket'): - address = conf['socket'] - else: - address = os.path.join(conf.get('root_path', ''), 'fcgi_sock') - # @@: Right now there's no automatic socket, and the parent server - # can't start up this server in any way. - server = server_class( - app, - bindAddress=address, - multiplexed=pyconfig.make_bool(conf.get('multiplexed', False))) - return server.run() - -options = [ - Option('--socket', - metavar="FILENAME", - help='The filename of a socket to listen to for connections. Default is fcgi_sock in the current directory.'), - Option('--host', - metavar="HOST", - help='The host to bind to when listening for connections over the network. You must also provide port if you provide host.'), - Option('--port', - metavar="PORT", - help='The port to bind to.'), - Option('--multiplex', - metavar="true/false", - help='Option to multiplex connections (default: false).'), - ] - -description = """\ -A FastCGI threaded server. For more information on FastCGI see -<http://www.fastcgi.com>. This server is from flup: -<http://www.saddi.com/software/flup/>. -""" diff --git a/paste/servers/scgi_flup_fork_server.py b/paste/servers/scgi_flup_fork_server.py deleted file mode 100644 index 67d5e1e..0000000 --- a/paste/servers/scgi_flup_fork_server.py +++ /dev/null @@ -1,12 +0,0 @@ -from scgi_threaded_server import * - -def serve(conf, app): - from flup.server.scgi_fork import WSGIServer - return serve_server(conf, app, WSGIServer) - -description = """\ -A SCGI forking (multiprocess) server. SCGI is a FastCGI alternative -(see <http://www.mems-exchange.org/software/scgi/> for more). This -server (unlike the 'scgi' server, which is also forking) is from flup: -<http://www.saddi.com/software/flup/>. -""" diff --git a/paste/servers/scgi_server/__init__.py b/paste/servers/scgi_server/__init__.py deleted file mode 100644 index 9f56609..0000000 --- a/paste/servers/scgi_server/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -from optparse import Option -from paste.util import thirdparty -thirdparty.add_package('scgi') -from scgiserver import serve_application - -def serve(conf, app): - prefix = conf.get('root_url', '').rstrip('/') - serve_application(app, prefix, port=int(conf.get('port', 4000))) - -options = [ - Option('--port', - metavar="PORT", - help='Port to serve on (default 4000).'), - Option('--root-url', - metavar="URL", - help='The URL level to expect for incoming connections; if not set and this is not bound to /, then SCRIPT_NAME and PATH_INFO may be incorrect.'), - ] - -description = """\ -A pre-forking SCGI server. SCGI is a FastCGI alternative -(see <http://www.mems-exchange.org/software/scgi/> for more). -""" diff --git a/paste/servers/scgi_server/scgiserver.py b/paste/servers/scgi_server/scgiserver.py deleted file mode 100644 index fabeeda..0000000 --- a/paste/servers/scgi_server/scgiserver.py +++ /dev/null @@ -1,149 +0,0 @@ -#! /usr/bin/env python -""" -SCGI-->WSGI application proxy, "SWAP". - -(Originally written by Titus Brown.) - -This lets an SCGI front-end like mod_scgi be used to execute WSGI -application objects. To use it, subclass the SWAP class like so: - - - class TestAppHandler(swap.SWAP): - def __init__(self, *args, **kwargs): - self.prefix = '/canal' - self.app_obj = TestAppClass - swap.SWAP.__init__(self, *args, **kwargs) - -where 'TestAppClass' is the application object from WSGI and '/canal' -is the prefix for what is served by the SCGI Web-server-side process. - -Then execute the SCGI handler "as usual" by doing something like this - - scgi_server.SCGIServer(TestAppHandler, port=4000).serve() - -and point mod_scgi (or whatever your SCGI front end is) at port 4000. - -Kudos to the WSGI folk for writing a nice PEP & the Quixote folk for -writing a nice extensible SCGI server for Python! -""" - -import sys -import time -import os -from scgi import scgi_server - -def debug(msg): - timestamp = time.strftime("%Y-%m-%d %H:%M:%S", - time.localtime(time.time())) - sys.stderr.write("[%s] %s\n" % (timestamp, msg)) - -class SWAP(scgi_server.SCGIHandler): - """ - SCGI->WSGI application proxy: let an SCGI server execute WSGI - application objects. - """ - app_obj = None - prefix = None - - def __init__(self, *args, **kwargs): - assert self.app_obj, "must set app_obj" - assert self.prefix, "must set prefix" - args = (self,) + args - scgi_server.SCGIHandler.__init__(*args, **kwargs) - - def handle_connection(self, conn): - """ - Handle an individual connection. - """ - input = conn.makefile("r") - output = conn.makefile("w") - - environ = self.read_env(input) - environ['wsgi.input'] = input - environ['wsgi.errors'] = sys.stderr - environ['wsgi.version'] = (1,0) - environ['wsgi.multithread'] = False - environ['wsgi.multiprocess'] = True - environ['wsgi.run_once'] = False - - # dunno how SCGI does HTTPS signalling; can't test it myself... @CTB - if environ.get('HTTPS','off') in ('on','1'): - environ['wsgi.url_scheme'] = 'https' - else: - environ['wsgi.url_scheme'] = 'http' - - ## SCGI does some weird environ manglement. We need to set - ## SCRIPT_NAME from 'prefix' and then set PATH_INFO from - ## REQUEST_URI. - - prefix = self.prefix - path = environ['REQUEST_URI'][len(prefix):] - path = path.split('?', 1)[0] - - environ['SCRIPT_NAME'] = prefix - environ['PATH_INFO'] = path - - headers_set = [] - headers_sent = [] - chunks = [] - def write(data): - chunks.append(data) - - def start_response(status,response_headers,exc_info=None): - if exc_info: - try: - if headers_sent: - # Re-raise original exception if headers sent - raise exc_info[0], exc_info[1], exc_info[2] - finally: - exc_info = None # avoid dangling circular ref - elif headers_set: - raise AssertionError("Headers already set!") - - headers_set[:] = [status,response_headers] - return write - - ### - - result = self.app_obj(environ, start_response) - try: - for data in result: - chunks.append(data) - - # Before the first output, send the stored headers - if not headers_set: - # Error -- the app never called start_response - status = '500 Server Error' - response_headers = [('Content-type', 'text/html')] - chunks = ["XXX start_response never called"] - else: - status, response_headers = headers_sent[:] = headers_set - - output.write('Status: %s\r\n' % status) - for header in response_headers: - output.write('%s: %s\r\n' % header) - output.write('\r\n') - - for data in chunks: - output.write(data) - finally: - if hasattr(result,'close'): - result.close() - - # SCGI backends use connection closing to signal 'fini'. - try: - input.close() - output.close() - conn.close() - except IOError, err: - debug("IOError while closing connection ignored: %s" % err) - - -def serve_application (application, prefix, port): - class SCGIAppHandler(SWAP): - def __init__ (self, *args, **kwargs): - self.prefix = prefix - self.app_obj = application - SWAP.__init__(self, *args, **kwargs) - - scgi_server.SCGIServer(SCGIAppHandler, port=port).serve() diff --git a/paste/servers/scgi_threaded_server.py b/paste/servers/scgi_threaded_server.py deleted file mode 100644 index a023e7f..0000000 --- a/paste/servers/scgi_threaded_server.py +++ /dev/null @@ -1,42 +0,0 @@ -from paste.util import thirdparty -thirdparty.add_package('flup') -from paste import pyconfig -from optparse import Option - -def serve(conf, app): - from flup.server.scgi import WSGIServer - return serve_server(conf, app, WSGIServer) - -def serve_server(conf, app, server_class): - root_url = conf.get('root_url', '') - root_url = root_url and root_url.rstrip('/') - server = server_class( - app, - bindAddress=(conf.get('host', 'localhost'), - int(conf.get('port', '4000'))), - scriptName=root_url, - allowedServers=pyconfig.make_list(conf.get('allowed_servers', None))) - return server.run() - -options = [ - Option('--host', - metavar='HOST', - help='The host name to bind to (default localhost). Note, if binding to localhost, only local connections will be allowed.'), - Option('--port', - metavar="PORT", - help='The port to bind to (default 4000).'), - Option('--root-url', - metavar="URL", - help='The URL level to expect for incoming connections; if not set and this is not bound to /, then SCRIPT_NAME and PATH_INFO may be incorrect.'), - Option('--allowed-servers', - metavar="URL_LIST", - help='A list of servers to allow connections from.'), - ] - -description = """\ -A SCGI multithreaded server. SCGI is a FastCGI alternative (see -<http://www.mems-exchange.org/software/scgi/> for more). This server -is from flup: <http://www.saddi.com/software/flup/>. -""" - -# @@: TODO: handle the logging level, or integrate logging diff --git a/paste/servers/server_script_template.py.txt b/paste/servers/server_script_template.py.txt deleted file mode 100644 index e1e7e86..0000000 --- a/paste/servers/server_script_template.py.txt +++ /dev/null @@ -1,16 +0,0 @@ -import os -import sys -sys.path.extend(@@extra_sys_path@@) -from paste import server -from paste.pyconfig import Config - -conf = Config(with_default=True) -conf.load_dict(@@other_conf@@) -server.load_conf(conf, @@default_config_fn@@) -if not conf.get('no_server_conf') and os.path.exists('server.conf'): - server.load_conf(conf, 'server.conf') -if conf.get('config_file'): - server.load_conf(conf, conf['config_file']) -conf.update_sys_path() - -app = server.make_app(conf) diff --git a/paste/servers/wsgiutils_server.py b/paste/servers/wsgiutils_server.py deleted file mode 100644 index ce501f4..0000000 --- a/paste/servers/wsgiutils_server.py +++ /dev/null @@ -1,24 +0,0 @@ -from optparse import Option -from paste.util import thirdparty -thirdparty.add_package('wsgiutils') -from wsgiutils import wsgiServer - -def serve(conf, app): - server = wsgiServer.WSGIServer( - (conf.get('host', 'localhost'), - int(conf.get('port', 8080))), {'': app}) - server.serve_forever() - -description = """\ -WSGIUtils <http://www.owlfish.com/software/wsgiutils/> is a small -threaded server using Python's standard SimpleHTTPServer. -""" - -options = [ - Option('--port', - metavar="PORT", - help='Port to serve on (default: 8080)'), - Option('--host', - metavar="HOST", - help='Host to serve from (default: localhost, which is only accessible from the local computer; use 0.0.0.0 to make your application public)'), - ] |