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
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)