Ejemplo n.º 1
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.º 2
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
Ejemplo n.º 3
0
def format_exception(exception_info):
    return to_unicode(b''.join(traceback.format_exception(*exception_info)),
                      strict=False)
Ejemplo n.º 4
0
def format_exception(exception_info):
    return to_unicode(b''.join(traceback.format_exception(*exception_info)))
Ejemplo n.º 5
0
Archivo: queue.py Proyecto: chenxc/veil
 def __init__(self, resq):
     self.opened_by = to_unicode(str('').join(traceback.format_stack()))
     self.resq = resq
Ejemplo n.º 6
0
Archivo: queue.py Proyecto: chenxc/veil
 def __init__(self):
     self.opened_by = to_unicode(str('').join(traceback.format_stack()))
     self.stopped = False
     self.queued_jobs = []