Created
September 16, 2013 05:46
-
-
Save graffic/6577063 to your computer and use it in GitHub Desktop.
Pyramid bootstrap setting a base_url for the request.
This file contains 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
def bootstrap(config_uri, options=None): | |
""" | |
Bootstraps a pyramid environment | |
Differences with the default pyramid bootstrap: | |
- It handles tasks.base_url | |
""" | |
app = get_app(config_uri, options=options) | |
registry = global_registries.last | |
base_url = registry.settings.get('tasks.base_url', None) | |
factory = registry.queryUtility(IRequestFactory, default=Request) | |
request = factory.blank('/', base_url=base_url) | |
env = prepare(request) | |
env['app'] = app | |
return env |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment