Created
April 6, 2011 15:46
-
-
Save ejucovy/905891 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### mymodule/filter.py | |
class PageClassFilter(object): | |
def __init__(self, inner_app, classes): | |
self.inner_app = inner_app | |
self.classes = classes | |
def __call__(self, environ, start_response): | |
environ['deliverance.page_classes'] = self.classes | |
return self.inner_app(environ, start_response) | |
def filter_factory(*args, classes): | |
classes = classes.split() | |
def filter(app): | |
return PageClassFilter(app, classes) | |
return filter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### paste.ini | |
[composite:main] | |
use = egg:Paste#urlmap | |
/foo = app1 | |
/bar = app2 | |
[app:app1] | |
use = egg:MyProject#app1 | |
filter-with = app1-filter | |
[app:app2] | |
use = egg:MyProject#app2 | |
filter-with = app2-filter | |
[filter:app1-filter] | |
paste.filter_factory = mymodule.filter:filter_factory | |
classes = class1 class2 | |
[filter:app2-filter] | |
paste.filter_factory = mymodule.filter:filter_factory | |
classes = class3 class4 class5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment