def template_json(web, data): value = json.dumps(data) if web.input('jsonp'): value = web.input('jsonp') + "(" + value + ");\n" header('Content-Type', "text/javascript") else: header('Content-Type', "application/json") response = append("") response.config['body'] = "" return response.append(value)
def template_atom(**kwargs): header('Content-Type', "application/atom+xml") return template("comments_atom.tpl", pentamediaportal = pentamediaportal, **kwargs)
def template_episodes_atom(**kwargs): header('Content-Type', "application/atom+xml") return template("episodes_atom.tpl", remove_html = remove_html, clean_category = clean_category, pentamediaportal = pentamediaportal, **kwargs)
def clear(): cookie = Cookie.SimpleCookie() cookie[juno.site_config('session')['cookie']] = "" juno.header('Set-Cookie', cookie.output(header=''))
def set_user(user): cookie = Cookie.SimpleCookie() key = str(user.key()) hash = hashlib.sha1(key+juno.site_config('session')['salt']).hexdigest() cookie[juno.site_config('session')['cookie']] = '%s:%s' % (hash, key) juno.header('Set-Cookie', cookie.output(header=''))
def template_tb(**kwargs): response = template("trackback.tpl",**kwargs) header('Content-Type',"text/xml") return response