diff uploader/dispatcher.py @ 3:bb2d34fb5de4

allow to be used as middleware
author k0s <k0scist@gmail.com>
date Sun, 27 Dec 2009 16:27:34 -0500
parents 0b5fce452087
children e5efa999911a
line wrap: on
line diff
--- a/uploader/dispatcher.py	Sun Dec 27 15:37:51 2009 -0500
+++ b/uploader/dispatcher.py	Sun Dec 27 16:27:34 2009 -0500
@@ -12,7 +12,8 @@
     defaults = { 'directory': None,
                  'auth': 'False',
                  'query_string': None,
-                 'subpath': 'False' }
+                 'subpath': 'False',
+                 'app': None}
 
     def __init__(self, **kw):
         for key in self.defaults:
@@ -38,6 +39,8 @@
                 handler = h(self, request)
                 break
         else:
+            if self.app:
+                return self.app(environ, start_response)
             handler = exc.HTTPNotFound
         res = handler()
         return res(environ, start_response)