Exemplo n.º 1
0
def render_template(template, layout='', vars=None, env=None):
    from uliweb import application as app

    vars = vars or {}
    env = env or app.get_view_env()
    loader = app.template_loader
    return loader.load(template, layout=layout).generate(vars, env)
Exemplo n.º 2
0
 def f():
     content = file(_f).read()
     if render:
         content = to_html(template(content, env=application.get_view_env()))
     else:
         content = to_html(content)
     return application.template('show_document.html', locals())
Exemplo n.º 3
0
 def f(*args, **kwargs):
     from uliweb import application
     if application:
         env = application.get_view_env()
         for k, v in env.iteritems():
             src.func_globals[k] = v
         
         src.func_globals['env'] = env
     return des(*args, **kwargs)
Exemplo n.º 4
0
        def f(*args, **kwargs):
            from uliweb import application
            if application:
                env = application.get_view_env()
                for k, v in env.iteritems():
                    src.func_globals[k] = v

                src.func_globals['env'] = env
            return des(*args, **kwargs)
Exemplo n.º 5
0
        def f(*args, **kwargs):
            from uliweb import application
            if application:
                env = application.get_view_env()
                for k, v in iteritems(env):
                    src.__globals__[k] = v

                src.__globals__['env'] = env
            return des(*args, **kwargs)