Esempio n. 1
0
def render_template(*args, **kwargs):
    return _render_template(
        *args,
        external_ipseity_url=environ.get('EXTERNAL_IPSEITY_URL'),
        json_token=g.get('json_token'),
        raw_token=g.get('raw_token'),
        **kwargs)
Esempio n. 2
0
def render_template(fname, *args, **kwargs):
    kwargs['NAME'] = app.config['NAME']
    kwargs['DEBUG'] = app.debug
    kwargs['DEV'] = app.config['DEV']
    kwargs['LANG'] = app.config['LANG']
    kwargs['active'] = fname.split('.')[0]
    kwargs['aname'] = session.get('aname', '')
    return _render_template(fname, *args, **kwargs)
Esempio n. 3
0
def render_template(*args, **kwargs):
    """Add common properties via a custom render_template function."""
    kwargs['modified'] = kwargs.get('modified', last_modified)
    kwargs['current_year'] = kwargs.get('current_year', datetime.now().year)

    analytics_id = current_app.config['GOOGLE_ANALYTICS_UNIVERSAL_ID']
    kwargs['google_analytics_id'] = analytics_id

    return _render_template(*args, **kwargs)
Esempio n. 4
0
def render_template(*args, **kwargs):
    """Add common properties via a custom render_template function."""
    kwargs['modified'] = kwargs.get('modified', last_modified)
    kwargs['current_year'] = kwargs.get('current_year', datetime.now().year)

    analytics_id = current_app.config['GOOGLE_ANALYTICS_UNIVERSAL_ID']
    kwargs['google_analytics_id'] = analytics_id

    return _render_template(*args, **kwargs)
Esempio n. 5
0
def render_template(filename, **kwargs):
    template_folder = app.template_folder
    template_folder = template_folder.replace(app.config['ROOT_DIR'], '')

    kwargs['github_url'] = app.config['GITHUB_URL'].format(
        template_folder=template_folder.strip('/'),
        filename=filename
    )
    return _render_template(filename, **kwargs)
Esempio n. 6
0
def render_template(template_name, **context):
    """Renders a page and supplies the correct extend base."""

    base = "base.html"
    if request.args.get('ajax') is not None:
        base = "base_ajax.html"

    context['template_base'] = base

    return _render_template(template_name, **context)
Esempio n. 7
0
def render_template(template_name_or_list, **context):

    curframe = currentframe()
    calframe = getouterframes(curframe, 2)
    function_name = calframe[1][3]
    function_name = ' '.join(function_name.split('_')).title()

    context['page_title'] = function_name

    return _render_template(template_name_or_list=template_name_or_list,
                            **context)
Esempio n. 8
0
def render_template(template, **variables):
    """
    Wrapper around flask.render_template to add in some extra variables.
    See doc/template.rst
    """
    # g.user is constructed in app.py's setup()
    variables['user_record'] = g.user
    variables['logged_in'] = g.user is not None
    variables['login_url'] = app.cas_login
    if g.user:
        variables['user_name'] = g.user.full_name
    else:
        variables['user_name'] = u''
    if g.user is None:
        variables['is_admin'] = None
    else:
        # TODO: Be able to mark users as admins
        variables['is_admin'] = g.user.user_name == app.config.get("ADMIN_USER", u"")

    return _render_template(template, **variables)
def render_template(filename, *args, **kwargs):
    """Blueprint Patched render_template. 

    If a filename is passed starting with '.', the current blueprint will
    be prepended plus an additional slash.

    This allows using duplicate filenames without worrying about rendering
    the wrong file.

    Example:

        .index.html will be converted into: <current_blueprint>/index.html

    """

    if filename.startswith('.'):
        if request.blueprint:
            # Filename started with ., expecting a blueprint relative path.
            filename = request.blueprint + "/" + filename[1:]
        else:
            # No blueprint found. Assuming this was a mistake.
            filename = filename[1:]

    return _render_template(filename, *args, **kwargs)
Esempio n. 10
0
def render_template(filename, **kwargs):
    kwargs['template_url'] = app.config['TEMPLATES_DIR_URL'] + filename
    return _render_template(filename, **kwargs)
Esempio n. 11
0
def render_template(filename, **kwargs):
    kwargs['template_url'] = app.config['TEMPLATES_DIR_URL'] + filename
    return _render_template(filename, **kwargs)
Esempio n. 12
0
def render_template(name, **kwargs):
    if "page_id" not in kwargs and name.endswith(".html"):
        kwargs["page_id"] = name.replace(".html", "")

    return _render_template(name, **kwargs)
Esempio n. 13
0
def page_not_found(e):
    return _render_template('404.html'), 404
Esempio n. 14
0
def render_template(template_name_or_list, **context):
    context.update({
        'current_user': current_user,
        'url_for_security': url_for_security
    })
    return _render_template(template_name_or_list, **context)
Esempio n. 15
0
def render_template(*args, **kwargs):
    return _render_template(*args, gt=GTDict, **kwargs)
Esempio n. 16
0
def render_template(filename, **kwargs):
    kwargs["template_url"] = app.config["TEMPLATES_DIR_URL"] + filename
    return _render_template(filename, **kwargs)
Esempio n. 17
0
def render_template(template_name, **context):
    full_name = get_template(template_name)
    return _render_template(full_name, **context)