Пример #1
0
def short_link(shortlink):
    shl = dbj.get_short(shortlink)
    if not shl:
        return (
            '<form method="POST"><input type="text" name="shl" style="width:100%" /><input type="submit" value="Save" /></form>'
        )
    redirect('/q/%s' % shl)
Пример #2
0
def set_link(shortlink):
    shl = request.forms.shl.split()
    for n in shl:
        if len(n) != 20:
            return 'wrong %s' % n
    shl = '/'.join(shl)
    dbj.set_short(shortlink, shl)
    redirect('/q/%s' % shl)
Пример #3
0
def post_user(ea):
    if request.forms.outtxt:
        data = mydict(request.forms)
        uu = userbb.check_auth(data.uhash)
        if uu:
            data.update(uname=uu.uname.encode('utf-8'),
                        addr='%s,%s' % (conf.STREET, uu.id))
        else:
            return 'no hash - no msg'
        app_rq('point/user/ea/%s' % ea, data)
    redirect(request.forms.beback or '/:%s' % ea)
Пример #4
0
def user_module(umod):
    out = userbb.uweb(umod, request.params, request.cookies)
    if 'cookie' in out:
        for k, v in out.cookie.items():
            response.set_cookie(k, v, path='/', max_age=7776000)
            return ('''<html><head>
                    <meta http-equiv="refresh" content="0; %s" />
                    </head><body></body></html>''' % out.redir)
    elif 'redir' in out:
        redirect(out.redir)
    elif 'txt' in out:
        request.content_type = 'text/plain; charset=utf-8'
        return out.txt
    else:
        return out.html
Пример #5
0
def reply_to(ea, repto):
    u = get_u()
    if not u:
        redirect('/user/me?redir=/reply/%s/%s' % (ea, repto))
    rep = repto if repto != '-' else ''
    if rep:
        # fix msgs// !
        rmsg = app_rq('msgs/%s/fmt/noempty' % rep)
    else:
        rmsg = mydict()
    return template('tpl/mform.html',
                    rmsg=rmsg,
                    ea=ea,
                    repto=rep,
                    u=u,
                    zo=request.query.tn)
Пример #6
0
def ecfg_save(ss=0):
    uu = userbb.check_auth(request.forms.uhash)
    if not uu or not uu.root:
        return 'no access'
    open('subs%s.lst' % ss, 'w').write(request.forms.txt)
    redirect('/ecfg' if ss == 0 else '/ecfg/%s' % ss)