From ca573ea73db05d7ea9bdbb51eb7db26ab602ccf2 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Wed, 16 Dec 2015 19:50:13 -0600 Subject: defer prevent check until register --- pyramid/config/views.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyramid/config/views.py b/pyramid/config/views.py index 759276351..acaf9462b 100644 --- a/pyramid/config/views.py +++ b/pyramid/config/views.py @@ -2102,9 +2102,6 @@ class StaticURLInfo(object): config.action(None, callable=register, introspectables=(intr,)) def add_cache_buster(self, config, spec, cachebust, explicit=False): - if config.registry.settings.get('pyramid.prevent_cachebust'): - return - # ensure the spec always has a trailing slash as we only support # adding cache busters to folders, not files if os.path.isabs(spec): # FBO windows @@ -2115,6 +2112,9 @@ class StaticURLInfo(object): spec = spec + sep def register(): + if config.registry.settings.get('pyramid.prevent_cachebust'): + return + cache_busters = self.cache_busters # find duplicate cache buster (old_idx) @@ -2138,6 +2138,7 @@ class StaticURLInfo(object): if old_idx is not None: cache_busters.pop(old_idx) + cache_busters.insert(new_idx, (spec, cachebust, explicit)) intr = config.introspectable('cache busters', -- cgit v1.2.3