blob: 0494307234a8b011e5ce20ec8b18f7b0232ad755 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
from zope.component import getAdapter
from repoze.bfg.interfaces import IWSGIApplication
class Router:
def __init__(self, app, policy):
self.app = app
self.policy = policy
def __call__(self, environ, start_response):
context, name, subpath = self.policy(environ)
app = getAdapter(context, IWSGIApplication, name)
environ['repoze.bfg.context'] = context
environ['repoze.bfg.subpath'] = subpath
return app(environ, start_response)
|