diff options
| author | ianb <devnull@localhost> | 2005-11-14 02:32:20 +0000 |
|---|---|---|
| committer | ianb <devnull@localhost> | 2005-11-14 02:32:20 +0000 |
| commit | 544ec091ba44c47ca069c52ec93beffd5dc9aa79 (patch) | |
| tree | 8d335c202d5e3de217cb3f200a486b4a5867102e /paste/urlparser.py | |
| parent | 083691b5578158a92b5945724bfc91caed669681 (diff) | |
| download | paste-544ec091ba44c47ca069c52ec93beffd5dc9aa79.tar.gz | |
Added wsgi_application hook to objects that URLParser finds
Diffstat (limited to 'paste/urlparser.py')
| -rw-r--r-- | paste/urlparser.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/paste/urlparser.py b/paste/urlparser.py index c049a1c..0723ad4 100644 --- a/paste/urlparser.py +++ b/paste/urlparser.py @@ -385,17 +385,21 @@ def make_py(parser, environ, filename): if not module: return None if hasattr(module, 'application') and module.application: - return module.application + return getattr(module.application, 'wsgi_application', module.application) base_name = module.__name__.split('.')[-1] if hasattr(module, base_name): - return getattr(module, base_name)() + obj = getattr(module, base_name) + if hasattr(obj, 'wsgi_application'): + return obj.wsgi_application + else: + # @@: Old behavior; should probably be deprecated eventually: + return getattr(module, base_name)() environ['wsgi.errors'].write( "Cound not find application or %s in %s\n" % (base_name, module)) return None - -URLParser.register_constructor('.py', make_py) +URLParser.register_constructor('.py', make_py) class StaticURLParser(object): |
