예제 #1
0
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)
예제 #2
0
def template_atom(**kwargs):
    header('Content-Type', "application/atom+xml")
    return template("comments_atom.tpl",
                    pentamediaportal = pentamediaportal, **kwargs)
예제 #3
0
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)
예제 #4
0
def clear():
    cookie = Cookie.SimpleCookie()
    cookie[juno.site_config('session')['cookie']] = ""
    juno.header('Set-Cookie', cookie.output(header=''))
예제 #5
0
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=''))
예제 #6
0
def template_tb(**kwargs):
    response = template("trackback.tpl",**kwargs)
    header('Content-Type',"text/xml")
    return response