Esempio n. 1
0
def theme_static_with_version(ctx, filename, external=False):
    '''Override the default theme static to add cache burst'''
    if current_app.theme_manager.static_folder:
        url = assets.cdn_for('_themes.static',
                             filename=current.identifier + '/' + filename)
    else:
        url = assets.cdn_for('_themes.static',
                             themeid=current.identifier,
                             filename=filename)
    if url.endswith('/'):  # this is a directory, no need for cache burst
        return url
    if current_app.config['DEBUG']:
        burst = time()
    else:
        burst = current.entrypoint.dist.version
    return '{url}?_={burst}'.format(url=url, burst=burst)
Esempio n. 2
0
def tabular_manifest(ui, filename):
    '''
    Get an UI asset path from its manifest
    '''
    static_root = assets.cdn_for('tabular.static', filename=ui, _external=True)
    asset = assets.from_manifest(ui, filename, raw=True)
    return '/'.join((static_root, asset))
Esempio n. 3
0
def static_global(filename, _burst=True, **kwargs):
    if current_app.config['DEBUG'] or current_app.config['TESTING']:
        burst = time()
    else:
        burst = package_version('udata')
    if _burst:
        kwargs['_'] = burst
    return assets.cdn_for('static', filename=filename, **kwargs)
Esempio n. 4
0
def static_global(filename, _burst=True, **kwargs):
    if current_app.config['DEBUG'] or current_app.config['TESTING']:
        burst = time()
    else:
        burst = package_version('udata')
    if _burst:
        kwargs['_'] = burst
    return assets.cdn_for('static', filename=filename, **kwargs)
Esempio n. 5
0
def theme_static_with_version(ctx, filename, external=False):
    '''Override the default theme static to add cache burst'''
    if current_app.theme_manager.static_folder:
        url = assets.cdn_for('_themes.static',
                             filename=current.identifier + '/' + filename,
                             _external=external)
    else:
        url = assets.cdn_for('_themes.static',
                             themeid=current.identifier,
                             filename=filename,
                             _external=external)
    if url.endswith('/'):  # this is a directory, no need for cache burst
        return url
    if current_app.config['DEBUG']:
        burst = time()
    else:
        burst = current.entrypoint.dist.version
    return '{url}?_={burst}'.format(url=url, burst=burst)