diff options
| author | Chris McDonough <chrism@agendaless.com> | 2008-07-04 06:30:02 +0000 |
|---|---|---|
| committer | Chris McDonough <chrism@agendaless.com> | 2008-07-04 06:30:02 +0000 |
| commit | 612d7478492b8c96cb138b7ee6f9b1829d046fc8 (patch) | |
| tree | df5356c97b7fe9cc681553f156a9e4ddbb0a4b79 /repoze/bfg/router.py | |
| download | pyramid-612d7478492b8c96cb138b7ee6f9b1829d046fc8.tar.gz pyramid-612d7478492b8c96cb138b7ee6f9b1829d046fc8.tar.bz2 pyramid-612d7478492b8c96cb138b7ee6f9b1829d046fc8.zip | |
Start on bfg.
Diffstat (limited to 'repoze/bfg/router.py')
| -rw-r--r-- | repoze/bfg/router.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/repoze/bfg/router.py b/repoze/bfg/router.py new file mode 100644 index 000000000..049430723 --- /dev/null +++ b/repoze/bfg/router.py @@ -0,0 +1,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) |
