Ejemplo n.º 1
0
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
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 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