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