def get_dev_output(self, name): config = OFFLINE_MANIFEST[name] if isinstance(config, (tuple, list)): config = {'cache': config} elif isinstance(config, basestring): config = {'cache': (config, )} cache_pattern = prepare_patterns(get_tuple(config, 'cache', '.*'), 'OFFLINE_MANIFEST[%s]' % name) exclude = prepare_patterns(get_tuple(config, 'exclude'), "OFFLINE_MANIFEST[%s]['exclude']" % name) cache = set() for item in get_media_mapping().keys(): if cache_pattern.match(item) and not exclude.match(item): cache.add(item) cache -= set(OFFLINE_MANIFEST.keys()) # include raw url entries in cache section cache_urls = config.get('cache_urls', []) network = get_tuple(config, 'network', ('*', )) fallback = get_tuple(config, 'fallback') template = get_tuple( config, 'template') + ('mediagenerator/manifest/' + name, 'mediagenerator/manifest/base.manifest') content = render_to_string( template, { 'cache': cache, 'cache_urls': cache_urls, 'network': network, 'fallback': fallback, }) return content, 'text/cache-manifest'
def get_dev_output(self, name): config = OFFLINE_MANIFEST[name] if isinstance(config, (tuple, list)): config = {'cache': config} elif isinstance(config, basestring): config = {'cache': (config,)} cache_pattern = prepare_patterns(get_tuple(config, 'cache', '.*'), 'OFFLINE_MANIFEST[%s]' % name) exclude = prepare_patterns(get_tuple(config, 'exclude'), "OFFLINE_MANIFEST[%s]['exclude']" % name) cache = set() for item in get_media_mapping().keys(): if cache_pattern.match(item) and not exclude.match(item): cache.add(item) cache -= set(OFFLINE_MANIFEST.keys()) # include raw url entries in cache section cache_urls = config.get('cache_urls', []) network = get_tuple(config, 'network', ('*',)) fallback = get_tuple(config, 'fallback') template = get_tuple(config, 'template') + ( 'mediagenerator/manifest/' + name, 'mediagenerator/manifest/base.manifest' ) content = render_to_string(template, { 'cache': cache, 'cache_urls': cache_urls, 'network': network, 'fallback': fallback, }) return content, 'text/cache-manifest'
def get_dev_output(self, name): config = OFFLINE_MANIFEST[name] if isinstance(config, (tuple, list)): config = {'cache': config} elif isinstance(config, basestring): config = {'cache': (config,)} cache = tuple(get_tuple(config, 'cache', '*')) if cache == ('*',): cache = get_media_mapping().keys() cache = set(cache) - set(OFFLINE_MANIFEST.keys()) cache -= set(get_tuple(config, 'exclude')) network = get_tuple(config, 'network') fallback = get_tuple(config, 'fallback') template = get_tuple(config, 'template') + ( 'mediagenerator/manifest/' + name, 'mediagenerator/manifest/base.manifest' ) content = render_to_string(template, { 'cache': cache, 'network': network, 'fallback': fallback, }) return content, 'text/cache-manifest'
def get_dev_output(self, name): config = OFFLINE_MANIFEST[name] if isinstance(config, (tuple, list)): config = {"cache": config} elif isinstance(config, basestring): config = {"cache": (config,)} cache_pattern = prepare_patterns(get_tuple(config, "cache", ".*"), "OFFLINE_MANIFEST[%s]" % name) exclude = prepare_patterns(get_tuple(config, "exclude"), "OFFLINE_MANIFEST[%s]['exclude']" % name) cache = set() for item in get_media_mapping().keys(): if cache_pattern.match(item) and not exclude.match(item): cache.add(item) cache -= set(OFFLINE_MANIFEST.keys()) network = get_tuple(config, "network", ("*",)) fallback = get_tuple(config, "fallback") template = get_tuple(config, "template") + ( "mediagenerator/manifest/" + name, "mediagenerator/manifest/base.manifest", ) content = render_to_string(template, {"cache": cache, "network": network, "fallback": fallback}) return content, "text/cache-manifest"