예제 #1
0
파일: sbi.py 프로젝트: ngokevin/solitude
    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
예제 #2
0
파일: sbi.py 프로젝트: mstriemer/solitude
    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
예제 #3
0
파일: sbi.py 프로젝트: ngokevin/solitude
    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)
예제 #4
0
파일: sbi.py 프로젝트: mstriemer/solitude
    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)