def GET(self, pid, sf=None, wf=None): i = web.input() pid = pid.rstrip("/") p = get_petition_by_id(pid) if not p: raise web.notfound() options = ["unsign", "edit", "delete"] if i.get("m", None) in options: handler = getattr(self, "GET_" + i.m) return handler(pid) if not sf: sf = forms.signform() fill_user_details(sf) captcha_html = "" if to_congress(pid): if not wf: wf = forms.wyrform() fill_user_details(wf) captcha_html = wyrapp.prepare_for_captcha(wf) if "tid" in i: set_referrer_cookie(i.tid, pid) raise web.seeother("/%s" % pid) u = web.storage() u.email = helpers.get_loggedin_email() or helpers.get_unverified_email() u.isauthor = is_author(u.email, pid) u.issignatory = is_signatory(u.email, pid) p.isdraft = is_draft(p) p.signatory_count = get_num_signs(pid) msg, msg_type = helpers.get_delete_msg() return render.petition(p, u, sf, wf, captcha_html, msg)
def GET(self, pid, sf=None, wf=None): i = web.input() pid = pid.rstrip('/') p = get_petition_by_id(pid) if not p: raise web.notfound() options = ['unsign', 'edit', 'delete'] if i.get('m', None) in options: handler = getattr(self, 'GET_' + i.m) return handler(pid) if not sf: sf = forms.signform() fill_user_details(sf) captcha_html = '' if to_congress(pid): if not wf: wf = forms.wyrform() fill_user_details(wf) captcha_html = wyrapp.prepare_for_captcha(wf) if 'tid' in i: set_referrer_cookie(i.tid, pid) raise web.seeother('/%s' % pid) u = web.storage() u.email = helpers.get_loggedin_email() or helpers.get_unverified_email( ) u.isauthor = is_author(u.email, pid) u.issignatory = is_signatory(u.email, pid) p.isdraft = is_draft(p) p.signatory_count = get_num_signs(pid) msg, msg_type = helpers.get_delete_msg() return render.petition(p, u, sf, wf, captcha_html, msg)
def GET(self, pf=None, wf=None): pf = pf or forms.petitionform() if not wf: # create a new form and initialize with current user details wf = forms.wyrform() u = helpers.get_user() u and fill_user_details(wf, u) captcha_html = wyrapp.prepare_for_captcha(wf) msg, msg_type = helpers.get_delete_msg() return render.petitionform(pf, wf, captchas=captcha_html, msg=msg)
def GET(self, pf=None, wf=None): pf = pf or forms.petitionform() if not wf: #create a new form and initialize with current user details wf = forms.wyrform() u = helpers.get_user() u and fill_user_details(wf, u) captcha_html = wyrapp.prepare_for_captcha(wf) msg, msg_type = helpers.get_delete_msg() return render.petitionform(pf, wf, captchas=captcha_html, msg=msg)