Skip to content

Commit

Permalink
Pass un-molested settings to add_static_view
Browse files Browse the repository at this point in the history
Pyramid users expect to be able to register static views with asset
specs and then generate static urls with asset specs. Since webassets
needs the spec to be resolved before we pass it the configuration, we
should pass the original settings to the `add_static_view` call so that
if 'base_dir' is an asset spec 'static_url' works as expected.
  • Loading branch information
tilgovi committed Jul 10, 2014
1 parent 4c695b2 commit 8f6920a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyramid_webassets/__init__.py
Expand Up @@ -339,7 +339,8 @@ def add_assets_global(event):
def includeme(config):
config.add_subscriber(add_assets_global, 'pyramid.events.BeforeRender')

assets_env = get_webassets_env_from_settings(config.registry.settings)
settings = config.registry.settings
assets_env = get_webassets_env_from_settings(settings)

config.registry.registerUtility(assets_env, IWebAssetsEnvironment)

Expand All @@ -350,8 +351,8 @@ def includeme(config):

if assets_env.config['static_view']:
config.add_static_view(
assets_env.url,
assets_env.directory,
settings['webassets.base_url'],
settings['webassets.base_dir'],
cache_max_age=assets_env.config['cache_max_age']
)

Expand Down

0 comments on commit 8f6920a

Please sign in to comment.