def confirm(): # check if there is personal information to be confirmed if session.registration_person == None: redirect(URLWiki('start')) # construct display of data to be confirmed data = getPersonDataTable(session.registration_person) # The _name arguments are important as the one of the pressed button will appear in request.vars. form = FORM(TABLE(TR( INPUT(_type = 'submit', _class = 'button', _name = 'submit back', _value = T('back')), INPUT(_type = 'submit', _class = 'button', _name = 'submit send', _value = T('go!'), _id = config.cssid.waitmsgtrig) ) ), DIV(T(config.msg.wait), _id = config.cssid.waitmsg) ) if 'submit back' in request.vars: redirect(URL('form')) elif 'submit send' in request.vars: pe = PersonEntry(shotdb, session.registration_person, session.registration_person_id) # By default, every registration of a person (new or update) (re-) enables round mails. pe.set_mail_enabled() # Prevent multiple database entries # Note: The reference to the object session.registration_person can be deleted here. # The data persist in memory and the object pe contains a duplicate private reference. session.registration_person = None if pe.verified: # The person is known and the email has been verified already. pe.update() session.registration_person_id = pe.id nextpage = URL('sale', 'form') elif pe.exists: # The person is known but the email is yet to be verified. if pe.email_changed : pe.reset_verification() pe.update() session.registration_person_id = None shotdb.commit() RegistrationMail(auth, pe.id).send() nextpage = URLWiki('registration-final') else: # person is not known yet. pe.insert() session.registration_person_id = None shotdb.commit() RegistrationMail(auth, pe.id).send() nextpage = URLWiki('registration-final') redirect(nextpage) return(dict(data = data, form = form))
def confirm(): # check if there is personal information to be confirmed if session.appropriation_request == None: redirect(URLWiki('start')) # The _name arguments are important as the one of the pressed button will appear in request.vars. form = FORM(TABLE(TR( INPUT(_type = 'submit', _class = 'button', _name = 'submit back', _value = T('back')), INPUT(_type = 'submit', _class = 'button', _name = 'submit send', _value = T('go!'), _id = config.cssid.waitmsgtrig) ) ), DIV(T(config.msg.wait), _id = config.cssid.waitmsg) ) if 'submit back' in request.vars: redirect(URL('form')) elif 'submit send' in request.vars: pe = PersonEntry(shotdb, session.appropriation_request) if (pe.exists): # The person is known already. pe.update() else: # person is not known yet. pe.insert() ar = AppropriationRequestEntry(shotdb, session.appropriation_request, pe.id) # clear request data session.appropriation_request = None # send email to person who submitted the request shotdb.commit() AppropriationRequestMail(auth, ar.aid).send() # send email to team members script_path = 'applications/%s/%s' % (config.appname, 'background/mail/send_team_info_new_request.py') args = ['python', 'web2py.py', '-S', config.appname , '-M', '-R', script_path, '-A'] args.extend([str(ar.aid)]) subprocess.Popen(args) redirect(URLWiki('appropriation-final')) return(dict(data_person = getPersonDataTable(session.appropriation_request, type = 'appropriation'), data_project = getAppRequestDataTable(session.appropriation_request), form = form))
def confirm(): # check if there is personal information to be confirmed if session.appropriation_request == None: redirect(URLWiki('start')) # The _name arguments are important as the one of the pressed button will appear in request.vars. form = FORM(TABLE(TR( INPUT(_type = 'submit', _class = 'button', _name = 'submit back', _value = T('back')), INPUT(_type = 'submit', _class = 'button', _name = 'submit send', _value = T('go!'), _id = config.cssid.waitmsgtrig) ) ), DIV(T(config.msg.wait), _id = config.cssid.waitmsg) ) if 'submit back' in request.vars: redirect(URL('form')) elif 'submit send' in request.vars: pe = PersonEntry(shotdb, session.appropriation_request) if (pe.exists): # The person is known already. pe.update() else: # person is not known yet. pe.insert() ar = AppropriationRequestEntry(shotdb, session.appropriation_request, pe.id) # clear request data session.appropriation_request = None # send email shotdb.commit() AppropriationRequestMail(auth, ar.aid).send() redirect(URLWiki('appropriation-final')) return(dict(data_person = getPersonDataTable(session.appropriation_request), data_project = getAppRequestDataTale(session.appropriation_request), form = form))