Mercurial > hg > wordstream
comparison wordstream/factory.py @ 3:e21f53582267
adding final dissociation stuff
author | k0s <k0scist@gmail.com> |
---|---|
date | Fri, 12 Feb 2010 01:37:38 -0500 |
parents | 8af3412e907a |
children |
comparison
equal
deleted
inserted
replaced
2:df84e61ae1e4 | 3:e21f53582267 |
---|---|
1 import os | 1 import os |
2 | 2 |
3 from dispatcher import Dispatcher | 3 from dispatcher import Dispatcher |
4 from dispatcher import Scrambler | |
4 from paste.httpexceptions import HTTPExceptionHandler | 5 from paste.httpexceptions import HTTPExceptionHandler |
5 from paste.urlparser import StaticURLParser | 6 from paste.urlparser import StaticURLParser |
6 from pkg_resources import resource_filename | 7 from pkg_resources import resource_filename |
7 | 8 |
8 class PassthroughFileserver(object): | 9 class PassthroughFileserver(object): |
27 for key, value in app_conf.items() | 28 for key, value in app_conf.items() |
28 if key.startswith(keystr) ]) | 29 if key.startswith(keystr) ]) |
29 app = Dispatcher(**args) | 30 app = Dispatcher(**args) |
30 return HTTPExceptionHandler(PassthroughFileserver(app, resource_filename(__name__, 'static'))) | 31 return HTTPExceptionHandler(PassthroughFileserver(app, resource_filename(__name__, 'static'))) |
31 | 32 |
33 def dissociate_factory(global_conf, **app_conf): | |
34 keystr = 'dissociate.' | |
35 args = dict([(key.split(keystr, 1)[-1], value) | |
36 for key, value in app_conf.items() | |
37 if key.startswith(keystr) ]) | |
38 app = Scrambler(**args) | |
39 return HTTPExceptionHandler(app) | |
40 |