Ejemplo n.º 1
0
def get_hash_salt():
    global _hash_salt

    if get_executing_test(optional=True):
        return 'secret'
    if _hash_salt is None:
        _hash_salt = load_config_from(VEIL_ETC_DIR / 'hash.cfg', 'salt').salt
    return _hash_salt
Ejemplo n.º 2
0
def get_hash_salt():
    global _hash_salt

    if get_executing_test(optional=True):
        return 'secret'
    if _hash_salt is None:
        _hash_salt = load_config_from(VEIL_ETC_DIR / 'hash.cfg', 'salt').salt
    return _hash_salt
Ejemplo n.º 3
0
def get_or_create_environment():
    global env
    if env:
        return env
    jinja_tag = jinjatag.JinjaTag()
    env = Environment(
        loader=PrefixLoader(loaders, delimiter=':'),
        trim_blocks=True,
        lstrip_blocks=True,
        autoescape=True,
        extensions=['jinja2.ext.autoescape', 'jinja2.ext.i18n', jinja_tag])
    jinja_tag.init()
    env.filters.update(filters)
    env.install_null_translations()
    env.created_by = to_unicode(b''.join(traceback.format_stack()))
    executing_test = get_executing_test(optional=True)
    if executing_test:
        executing_test.addCleanup(reset_template_environment)
    return env
Ejemplo n.º 4
0
def get_or_create_environment():
    global env
    if env:
        return env
    jinja_tag = jinjatag.JinjaTag()
    env = Environment(loader=PrefixLoader(loaders, delimiter=':'),
                      trim_blocks=True,
                      lstrip_blocks=True,
                      autoescape=True,
                      extensions=['jinja2.ext.i18n', jinja_tag])
    jinja_tag.init()
    env.filters.update(filters)
    env.install_null_translations()
    env.created_by = to_unicode(b''.join(traceback.format_stack()),
                                strict=False)
    executing_test = get_executing_test(optional=True)
    if executing_test:
        executing_test.addCleanup(reset_template_environment)
    return env