def obj_create(self, bundle, request, **kwargs): form = SBIForm(bundle.data) if not form.is_valid(): raise self.form_errors(form) try: res = self.client("AcceptSBIAgreement", form.bango_data, raise_on=(SBI_ALREADY_ACCEPTED)) except BangoFormError, exc: if exc.id != SBI_ALREADY_ACCEPTED: raise
def obj_create(self, bundle, request, **kwargs): form = SBIForm(bundle.data) if not form.is_valid(): raise self.form_errors(form) try: res = self.client('AcceptSBIAgreement', form.bango_data, raise_on=(SBI_ALREADY_ACCEPTED)) except BangoFormError, exc: if exc.id != SBI_ALREADY_ACCEPTED: raise
def obj_get(self, request, **kwargs): # We are expecting the pk to be 'agreement' so that are we not doing a # get on a list and all the tastypie baggage that provides. if kwargs["pk"] != "agreement": raise ImmediateHttpResponse(response=HttpNotFound()) data = self.deserialize(request, request.raw_post_data, format="application/json") form = SBIForm(data) if not form.is_valid(): raise self.form_errors(form) res = self.client("GetSBIAgreement", form.bango_data) return SBIAgreement(res.sbiAgreement, res.sbiAgreementValidFrom, None, None)
def obj_get(self, request, **kwargs): # We are expecting the pk to be 'agreement' so that are we not doing a # get on a list and all the tastypie baggage that provides. if kwargs['pk'] != 'agreement': raise ImmediateHttpResponse(response=HttpNotFound()) data = self.deserialize(request, request.raw_post_data, format='application/json') form = SBIForm(data) if not form.is_valid(): raise self.form_errors(form) res = self.client('GetSBIAgreement', form.bango_data) return SBIAgreement(terms(res.sbiAgreement), res.sbiAgreementValidFrom, None, None)