Ejemplo n.º 1
0
 def render(self, request):
     """
     Leave the request open for future writes.
     """
     self.request = request
     if request.method not in self.allowedMethods:
         raise error.UnsupportedMethod(self.allowedMethods)
     self.request.write(b"some data")
     return server.NOT_DONE_YET
Ejemplo n.º 2
0
 def test_str(self):
     """
     The C{__str__} for L{UnsupportedMethod} makes it clear that what it
     shows is a list of the supported methods, not the method that was
     unsupported.
     """
     e = error.UnsupportedMethod([b"HEAD", b"PATCH"])
     self.assertEqual(
         str(e), "Expected one of [b'HEAD', b'PATCH']",
     )