(self, request)
return return_data
Parse the form used to subscribe and return a dict of processed data
Parse the form used to subscribe and return a dict of processed data
Parse the form used to subscribe and return a dict of processed data
def parse_form(self, request):
        ''' Parse the form used to subscribe and return a dict of processed data'''
        from generalforms import subscribe
        form = subscribe.AddPackForm(request.form)
        if request.method == "POST" and \
            "stripeToken" in request.form and "plan" in request.form:
            stripe_token = request.form['stripeToken']
            plan = request.form['plan']
            return_data = {'type': 'subscribe',
                           'stripe_token' : stripe_token,
                           'plan' : plan}
        elif request.method == "POST":
            if form.validate():
                return_data = {'type': 'adjust',
                               'quantity': int(form.add_packs.data)}
        else:
            return_data = False
        return return_data
def parse_form ( self , request ) : from generalforms import subscribe form = subscribe . AddPackForm ( request . form ) if request . method == "POST" and "stripeToken" in request . form and "plan" in request . form : stripe_token = request . form [ 'stripeToken' ] plan = request . form [ 'plan' ] return_data = { 'type' : 'subscribe' , 'stripe_token' : stripe_token , 'plan' : plan } elif request . method == "POST" : if form . validate ( ) : return_data = { 'type' : 'adjust' , 'quantity' : int ( form . add_packs . data ) } else : return_data = False return return_data