class HTTPResponse(MoleException): """ Used to break execution and immediately finish the response """ def __init__(self, output='', status=200, header=None): super(MoleException, self).__init__("HTTP Response %d" % status) self.status = int(status) self.output = output self.headers = HeaderDict(header) if header else None def apply(self, response): if self.headers: for key, value in self.headers.iterallitems(): response.headers[key] = value response.status = self.status
def __init__(self, output='', status=200, header=None): super(MoleException, self).__init__("HTTP Response %d" % status) self.status = int(status) self.output = output self.headers = HeaderDict(header) if header else None