mercredi 8 juillet 2015

What is the difference on APIClient.enforce_csrf_checks and APIClient.handler.enforce_csrf_checks

I noticed that when I create a handler

newClient = APIClient(enforce_csrf_checks=True)

that

newClient.enforce_csrf_checks = False 

but

newClient.handler.enforce_csrf_checks = True

What is the difference? I ask this because I have an existing API Client and I want to know the difference:

class ModifyTest(APITestCase):
    def setUp(self):
        self.client.enforce_csrf_checks = True          # Do this?
        self.client.handler.enforce_csrf_checks = True  # Or Do this?

Aucun commentaire:

Enregistrer un commentaire