json:add get_stats method

This commit is contained in:
Martijn Voncken 2008-06-30 17:40:28 +00:00
commit e2bc3dbd48

View file

@ -87,18 +87,36 @@ def self_url(**kwargs):
return config["base"] + changequery(**kwargs) return config["base"] + changequery(**kwargs)
def do_redirect(): def do_redirect():
import render """for redirects after a POST"""
"""go to /index unless the redir var is set."""
vars = web.input(redir = None) vars = web.input(redir = None)
ck = cookies()
url_vars = {}
if vars.redir: if vars.redir:
w_seeother(vars.redir) #redir variable contains base w_seeother(vars.redir) #redir variable contains base
return return
#test-alt-home #for the filters:
if hasattr(render,"home"): if ("order" in ck and "sort" in ck):
return render.home() url_vars.update({'sort':ck['sort'] ,'order':ck['order'] })
#default:
seeother('/index') organize = False
try:
organize = ('Organize' in sclient.get_enabled_plugins())
except:
pass
if organize:
#todo:DRY
if ("state" in ck) and ck['state']:
url_vars['state'] = ck['state']
if ("tracker" in ck) and ck['tracker']:
url_vars['tracker'] = ck['tracker']
if ("keyword" in ck) and ck['keyword']:
url_vars['keyword'] = ck['keyword']
#redirect.
w_seeother(url("/index", **url_vars))
def getcookie(key, default = None): def getcookie(key, default = None):
"because i'm too lazy to type 3 lines for something this simple" "because i'm too lazy to type 3 lines for something this simple"