bag.web.pyramid.cache_buster module

class bag.web.pyramid.cache_buster.CacheBustedStaticDirectories(config, cache_buster)[source]

Bases: object

DRY. Conveniently declare static views with cache busting.

add_static_view(name, spec, cache_max_age=86400)[source]
Return type

None

class bag.web.pyramid.cache_buster.GitCacheBuster(repo_path, param='x')[source]

Bases: pyramid.static.QueryStringCacheBuster

A cache buster that uses the hash of the current git commit.

Assuming your code is installed as a Git checkout, as opposed to an egg from an egg repository like PYPI, you can use this cache buster to get the current commit’s SHA1 to use as the cache bust token.

tokenize(request, pathspec, kw)[source]