Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.werkzeug.utils.DispatcherMiddleware Class Reference

List of all members.

Public Member Functions

def __init__
def __call__

Public Attributes

 app
 mounts

Detailed Description

Allows one to mount middlewares or application in a WSGI application.
This is useful if you want to combine multiple WSGI applications::

    app = DispatcherMiddleware(app, {
        '/app2':        app2,
        '/app3':        app3
    })

Definition at line 279 of file utils.py.


Constructor & Destructor Documentation

def MoinMoin.support.werkzeug.utils.DispatcherMiddleware.__init__ (   self,
  app,
  mounts = None 
)

Definition at line 289 of file utils.py.

00289 
00290     def __init__(self, app, mounts=None):
00291         self.app = app
00292         self.mounts = mounts or {}


Member Function Documentation

def MoinMoin.support.werkzeug.utils.DispatcherMiddleware.__call__ (   self,
  environ,
  start_response 
)

Definition at line 293 of file utils.py.

00293 
00294     def __call__(self, environ, start_response):
00295         script = environ.get('PATH_INFO', '')
00296         path_info = ''
00297         while '/' in script:
00298             if script in self.mounts:
00299                 app = self.mounts[script]
00300                 break
00301             items = script.split('/')
00302             script = '/'.join(items[:-1])
00303             path_info = '/%s%s' % (items[-1], path_info)
00304         else:
00305             app = self.mounts.get(script, self.app)
00306         original_script_name = environ.get('SCRIPT_NAME', '')
00307         environ['SCRIPT_NAME'] = original_script_name + script
00308         environ['PATH_INFO'] = path_info
00309         return app(environ, start_response)
00310 


Member Data Documentation

Definition at line 290 of file utils.py.

Definition at line 291 of file utils.py.


The documentation for this class was generated from the following file: