Skip to content
Browse files

Django's WSGI dispatcher now properly works since it needs to be inst…

…antiated first.
  • Loading branch information...
1 parent 0751065 commit 5597a2e307b91aa119af5f9e7c636231ed62c639 @brosner committed Jul 11, 2008
Showing with 8 additions and 1 deletion.
  1. +8 −1 bosnowsgi.py
View
9 bosnowsgi.py
@@ -103,10 +103,17 @@ def load_dispatcher(path):
Given a module path, e.g. "django.core.handlers.wsgi.WSGIHandler" return
the WSGIHandler object.
"""
+ must_be_called = False
+ if path.endswith("()"):
+ must_be_called = True
+ path = path[:-2]
dot = path.rindex(".")
dispatcher_mod, dispatcher_callable = path[:dot], path[dot+1:]
mod = __import__(dispatcher_mod, {}, {}, [""])
- return getattr(mod, dispatcher_callable)
+ dispatcher = getattr(mod, dispatcher_callable)
+ if must_be_called:
+ return dispatcher()
+ return dispatcher
def load_wsgi_server(name, **kwargs):
"""

0 comments on commit 5597a2e

Please sign in to comment.
Something went wrong with that request. Please try again.