diff options
author | Ian Bicking <ian@ianbicking.org> | 2005-06-02 18:12:57 +0000 |
---|---|---|
committer | Ian Bicking <ian@ianbicking.org> | 2005-06-02 18:12:57 +0000 |
commit | 07632df462f17c6af64a23766bfe3ccd208386be (patch) | |
tree | c0f47e4393336ddb005d4916877d369f4394ee3c /paste/webkit/wkservlet.py | |
parent | 01dd92ddde65c0be3eaf4b4804809cfae5f97cd8 (diff) | |
download | paste-git-07632df462f17c6af64a23766bfe3ccd208386be.tar.gz |
Added class property wsgi_app that serves as a WSGI application that creates new instances on each invocation
Diffstat (limited to 'paste/webkit/wkservlet.py')
-rw-r--r-- | paste/webkit/wkservlet.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/paste/webkit/wkservlet.py b/paste/webkit/wkservlet.py index 782fb97..47e9a89 100644 --- a/paste/webkit/wkservlet.py +++ b/paste/webkit/wkservlet.py @@ -7,6 +7,17 @@ applications, and __call__ is provided to do this. import wkcommon from wktransaction import Transaction +class make_application(object): + + def __get__(self, obj, type=None): + # Instances are already applications: + if obj: + return obj + # This application creates an instance for each call: + def application(environ, start_response): + return type()(environ, start_response) + return application + class Servlet(object): # This is nested in Servlet so that transactions can access it as @@ -33,6 +44,8 @@ class Servlet(object): except self.EndResponse: trans.response().deliver() return trans.response().wsgiIterator() + + wsgi_app = make_application() ## Access ## |