Beispiel #1
0
 def POST_password(self, pid):
     form = forms.passwordform()
     i = web.input()
     if form.validates(i):
         save_password(i)
         raise web.seeother('/%s' % pid)
     else:
         return self.GET(pid, passwordform=form)
Beispiel #2
0
    def GET(self, pid, signform=None, passwordform=None):
        i = web.input()
        
        options = ['signatories', 'unsign', 'edit', 'delete']
        if i.get('m', None) in options:
            handler = getattr(self, 'GET_'+i.m)
            return handler(pid)

        try:
            p = db.select('petition', where='id=$pid', vars=locals())[0]
        except:
            raise web.notfound
        
        p.signatory_count = db.query('select count(*) from signatory where petition_id=$pid',
                                        vars=locals())[0].count
        
        if not signform:
            signform = forms.signform()
            fill_user_details(signform, ['name', 'email'])
                                              
        if askforpasswd(p.owner_id) and not passwordform: passwordform = forms.passwordform()
        msg, msg_type = helpers.get_delete_msg()   
        return render.petition(p, signform, passwordform, msg)