示例#1
0
 def wrapper(*args, **kwargs):
     d = func(*args, **kwargs)
     d.update({
         'manager': web.request['stagehand.manager'],
         'config': config,
         'json': web.json_dumps,
         'root': config.web.proxied_root if 'X-Forwarded-Host' in web.request.headers else ''
     })
     session = web.request.cookies['stagehand.session']
     if session:
         d['async'] = asyncweb.pop_finished_jobs(session)
     return d
示例#2
0
def _render_cstemplate(fname, kwargs):
    # All templates get these special names exposed.
    kwargs.update({
        'manager': web.request['stagehand.manager'],
        'config': config,
        'json': json.dumps,
        'root': config.web.proxied_root if 'X-Forwarded-Host' in web.request.headers else ''
    })
    session = web.request.cookies['stagehand.session']
    if session:
        kwargs['async'] = asyncweb.pop_finished_jobs(session)
    # Now render the template.
    return bottle.template(fname, template_adapter=CSTemplate, **kwargs)
示例#3
0
文件: utils.py 项目: kisdma/stagehand
def _render_cstemplate(fname, kwargs):
    # All templates get these special names exposed.
    kwargs.update({
        'manager':
        web.request['stagehand.manager'],
        'config':
        config,
        'json':
        json.dumps,
        'root':
        config.web.proxied_root
        if 'X-Forwarded-Host' in web.request.headers else ''
    })
    session = web.request.cookies['stagehand.session']
    if session:
        kwargs['async'] = asyncweb.pop_finished_jobs(session)
    # Now render the template.
    return bottle.template(fname, template_adapter=CSTemplate, **kwargs)