def __init__(self, response='', start_response=None):
        self.status = '200 OK'
        self.content_type = 'text/html'
        self.headers = []
        self.body = ''
        
        if isinstance(response, Response):
            self.__dict__ = response.__dict__
        elif isinstance(response, HTTPException):
            self.status = '%d %s' % (response.code, response.name)
            self.body = response.get_error_body()
        else:
            self.body = response
        
        if isinstance(self.body, unicode):
            self.body = self.body.encode('utf-8')

        if start_response is not None:
            headers = [('Content-Type', "%s; charset=utf-8" \
                % self.content_type)] + self.headers
            start_response(self.status, headers)
dataset/ETHPy150Open fengsp/batpod/batpod.py/Response.__init__/original