Exemplo n.º 1
0
def doupdate(slug):
    user = request.form["user"]
    auth = request.form["auth"]
    if ( auth != calc_secret(user) ):
        print "Expected %s for user %s" % calc_secret(user),user

    update = request.form["data"]
    update = json.loads(update)
    update['update_time'] = datetime.datetime.now().strftime("%Y/%m/%d %H:%M:%S")

    currentrec = r.get("slug:%s" % slug)
    currentrec = json.loads(currentrec)
    currentrec.setdefault('updates',{}).setdefault(user,[]).insert(0,update)
    currentrec = json.dumps(currentrec,indent=0)
    r.set("slug:%s" % slug,currentrec)

    update_everything(slug)

    return redirect('/list')
Exemplo n.º 2
0
def setbaseinfo(slug):
    user = request.form["user"]
    auth = request.form["auth"]
    assert( auth == calc_secret(user) )
    assert( user == 'gov' )

    baseinfo = request.form["data"]
    baseinfo = json.loads(baseinfo) 

    currentrec = r.get("slug:%s" % slug)
    currentrec = json.loads(currentrec)
    currentrec['base'] = baseinfo
    currentrec = json.dumps(currentrec,indent=0)
    r.set("slug:%s" % slug,currentrec)

    update_everything(slug)

    return redirect('/list')