Example #1
0
    def test_theme_include_static(self):
        app = Flask(__name__)
        app.config['THEME_PATHS'] = [join(TESTS, 'morethemes')]
        Themes(app, app_identifier='testing')

        with app.test_request_context('/'):
            data = render_template('static_parent.html').strip()
            url = static_file_url('plain', 'style.css')
            assert data == 'Application, Plain, %s' % url
Example #2
0
    def test_theme_include_static(self):
        app = Flask(__name__)
        app.config['THEME_PATHS'] = [join(TESTS, 'morethemes')]
        Themes(app, app_identifier='testing')

        with app.test_request_context('/'):
            data = render_template('static_parent.html').strip()
            url = static_file_url('plain', 'style.css')
            assert data == 'Application, Plain, %s' % url
Example #3
0
    def test_theme_static(self):
        app = Flask(__name__)
        app.config['THEME_PATHS'] = [join(TESTS, 'morethemes')]
        Themes(app, app_identifier='testing')

        with app.test_request_context('/'):
            coolurl = static_file_url('cool', 'style.css')
            cooldata = render_theme_template('cool', 'static.html').strip()
            assert cooldata == 'Cool Blue v2, %s' % coolurl
Example #4
0
    def test_theme_static(self):
        app = Flask(__name__)
        app.config['THEME_PATHS'] = [join(TESTS, 'morethemes')]
        Themes(app, app_identifier='testing')

        with app.test_request_context('/'):
            coolurl = static_file_url('cool', 'style.css')
            cooldata = render_theme_template('cool', 'static.html').strip()
            assert cooldata == 'Cool Blue v2, %s' % coolurl
Example #5
0
    def test_static_file_url(self):
        app = Flask(__name__)
        app.config['THEME_PATHS'] = [join(TESTS, 'morethemes')]
        Themes(app, app_identifier='testing')

        with app.test_request_context('/'):
            url = static_file_url('cool', 'style.css')
            genurl = url_for('_themes.static', themeid='cool',
                             filename='style.css')
            assert url == genurl
Example #6
0
    def test_static_file_url(self):
        app = Flask(__name__)
        app.config['THEME_PATHS'] = [join(TESTS, 'morethemes')]
        Themes(app, app_identifier='testing')

        with app.test_request_context('/'):
            url = static_file_url('cool', 'style.css')
            genurl = url_for('_themes.static',
                             themeid='cool',
                             filename='style.css')
            assert url == genurl
Example #7
0
def favicon() :
    """
        App favicon
    """
    default = app.config['DEFAULT_THEME']
    theme_id = app.config.get(u'THEME', default)
    theme = get_theme(theme_id)
    path = op.join(theme.static_path, 'img', 'favicon.png')
    if op.exists(path) :
        url = static_file_url(theme, 'img/favicon.png')
    else :
        url = url_for('static', filename='img/favicon.png')
    return redirect(url)
Example #8
0
def get_img_files(theme):
	files = os.listdir(os.path.join(theme.static_path, 'img'))
	return [{'path': static_file_url(theme, os.path.join('img', f) )} for f in files]