示例#1
0
def find_asset(theme, asset):

    theme_path = ''
    for name, label, path in hz_themes.get_themes():
        if theme == name:
            theme_path = path

    theme_path = os.path.join(settings.ROOT_PATH, theme_path)

    # If there is a 'static' subdir of the theme, then use
    # that as the theme's asset root path
    static_path = os.path.join(theme_path, 'static')
    if os.path.exists(static_path):
        theme_path = static_path

    # The full path to the asset requested
    asset_path = os.path.join(theme_path, asset)
    if os.path.exists(asset_path):
        return_path = os.path.join(hz_themes.get_theme_dir(), theme, asset)
    else:
        return_path = os.path.join('dashboard', asset)

    return staticfiles_storage.url(pathname2url(return_path))
示例#2
0
文件: themes.py 项目: amotoki/horizon
def find_asset(theme, asset):

    theme_path = ''
    for name, label, path in hz_themes.get_themes():
        if theme == name:
            theme_path = path

    theme_path = os.path.join(settings.ROOT_PATH, theme_path)

    # If there is a 'static' subdir of the theme, then use
    # that as the theme's asset root path
    static_path = os.path.join(theme_path, 'static')
    if os.path.exists(static_path):
        theme_path = static_path

    # The full path to the asset requested
    asset_path = os.path.join(theme_path, asset)
    if os.path.exists(asset_path):
        return_path = os.path.join(hz_themes.get_theme_dir(), theme, asset)
    else:
        return_path = os.path.join('dashboard', asset)

    return staticfiles_storage.url(pathname2url(return_path))
示例#3
0
def theme_dir():
    return hz_themes.get_theme_dir()
示例#4
0
文件: themes.py 项目: amotoki/horizon
def theme_dir():
    return hz_themes.get_theme_dir()