summaryrefslogtreecommitdiff
path: root/paste
diff options
context:
space:
mode:
authorianb <devnull@localhost>2005-08-22 18:07:41 +0000
committerianb <devnull@localhost>2005-08-22 18:07:41 +0000
commitf327fd6689312d9a61cf00ed66cd6547aaef2729 (patch)
tree739d9141b2486d52a5531dc9ba5dd77ff570af6b /paste
parent60e17a73970d3e5b9414e1be9fd474ceb92f6afc (diff)
downloadpastedeploy-f327fd6689312d9a61cf00ed66cd6547aaef2729.tar.gz
New protocols, paste.server_runner1 and paste.filter_app_factory1
Diffstat (limited to 'paste')
-rw-r--r--paste/deploy/interfaces.py32
-rw-r--r--paste/deploy/loadwsgi.py32
2 files changed, 62 insertions, 2 deletions
diff --git a/paste/deploy/interfaces.py b/paste/deploy/interfaces.py
index efe5dd0..5f649cb 100644
--- a/paste/deploy/interfaces.py
+++ b/paste/deploy/interfaces.py
@@ -81,6 +81,21 @@ class IPasteFilterFactory1:
Returns a IFilter object.
"""
+class IPasteFilterAppFactory1:
+
+ """
+ This is the spec for the ``paste.filter_app_factory1``
+ protocol/entry_point.
+ """
+
+ def __call__(wsgi_app, global_conf, **local_conf):
+ """
+ Returns a WSGI application that wraps ``wsgi_app``.
+
+ Note that paste.deploy creates a wrapper for these
+ objects that implement the IFilter interface.
+ """
+
class IPasteServerFactory1:
"""
@@ -93,6 +108,23 @@ class IPasteServerFactory1:
Returns a IServer object.
"""
+class IPasteServerRunner1:
+
+ """
+ This is the spec for the ``paste.server_runner1``
+ protocol/entry_point.
+ """
+
+ def __call__(wsgi_app, global_conf, **local_conf):
+ """
+ Serves the given WSGI application. May serve once, many
+ times, forever; nothing about how the server works is
+ specified here.
+
+ Note that paste.deploy creates a wrapper for these
+ objects that implement the IServer interface.
+ """
+
class ILoader:
"""
diff --git a/paste/deploy/loadwsgi.py b/paste/deploy/loadwsgi.py
index 0d71233..9a970b9 100644
--- a/paste/deploy/loadwsgi.py
+++ b/paste/deploy/loadwsgi.py
@@ -73,14 +73,42 @@ APP.invoke = APP_invoke
FILTER = _ObjectType(
'filter',
- ['paste.filter_factory1'],
+ [['paste.filter_factory1', 'paste.filter_app_factory1']],
['filter'])
+def FILTER_invoke(context):
+ if context.protocol == 'paste.filter_factory1':
+ return context.object(context.global_conf, **context.local_conf)
+ elif context.protocol == 'paste.filter_app_factory1':
+ def filter_wrapper(wsgi_app):
+ # This should be an object, so it has a nicer __repr__
+ return context.object(wsgi_app, context.global_conf,
+ **context.local_conf)
+ return filter_wrapper
+ else:
+ assert 0, "Protocol %r unknown" % context.protocol
+
+FILTER.invoke = FILTER_invoke
+
SERVER = _ObjectType(
'server',
- ['paste.server_factory1'],
+ [['paste.server_factory1', 'paste.server_runner1']],
['server'])
+def SERVER_invoke(context):
+ if context.protocol == 'paste.server_factory1':
+ return context.object(context.global_conf, **context.local_conf)
+ elif context.protocol == 'paste.server_runner1':
+ def server_wrapper(wsgi_app):
+ # This should be an object, so it has a nicer __repr__
+ return context.object(wsgi_app, context.global_conf,
+ **context.local_conf)
+ return server_wrapper
+ else:
+ assert 0, "Protocol %r unknown" % context.protocol
+
+SERVER.invoke = SERVER_invoke
+
# Virtual type: (@@: There's clearly something crufty here;
# this probably could be more elegant)
PIPELINE = _ObjectType(