def _get_unsaved(self, id, if_not_found=None): """ if_not_found: pass in an HTTPRedirect() class to raise if the unsaved attendee is not found. by default we will redirect to the index page """ if id in Charge.unpaid_preregs: return Charge.from_sessionized(Charge.unpaid_preregs[id]) else: raise HTTPRedirect('index') if if_not_found is None else if_not_found
def paid_preregistrations(self, session, payment_received=None, message=''): if not Charge.paid_preregs: raise HTTPRedirect('index') else: preregs = [session.merge(Charge.from_sessionized(d)) for d in Charge.paid_preregs] for prereg in preregs: try: session.refresh(prereg) except Exception: pass # this badge must have subsequently been transferred or deleted return { 'preregs': preregs, 'total_cost': payment_received, 'message': message }
def _get_unsaved(self, id, if_not_found=None): """ if_not_found: pass in an HTTPRedirect() class to raise if the unsaved attendee is not found. by default we will redirect to the index page """ if id in Charge.unpaid_preregs: target = Charge.from_sessionized(Charge.unpaid_preregs[id]) if isinstance(target, Attendee): return target, Group() else: [leader] = [a for a in target.attendees if not a.is_unassigned] return leader, target else: raise HTTPRedirect( 'index') if if_not_found is None else if_not_found