Ejemplo n.º 1
0
 def setUp(self):
     drug = DRUGS.HEROIN
     self.town1 = get_tst_town()
     self.client1 = get_tst_client("c1", {"town": self.town1, "primary_drug": drug})
     self.harm_reduction = create_service(HarmReduction, self.client1, date(2011, 11, 1), self.town1)
     self.encounter = Encounter.objects.filter(person=self.client1)[0]
     handler = ServerHandler(sys.stdin, sys.stdout, sys.stderr, {"REQUEST_METHOD": "POST"})
     handler.setup_environ()
     self.request = WSGIRequest(handler.environ)
Ejemplo n.º 2
0
    def finish_response(self):
        try:
            ServerHandler.finish_response(self)

        # avoiding broken pipes
        # http://code.djangoproject.com/ticket/4444
        except Exception:
            exc_type, exc_value = sys.exc_info()[:2]
            if not issubclass(exc_type, socket.error) or exc_value.args[0] is 32:
                raise
Ejemplo n.º 3
0
 def __init__(self, *args, **kwargs):
     ServerHandler.__init__(self, *args, **kwargs)
     self.request_handler = DummyHandler()
     self._used_sendfile = False