(self, request, response, code=None, **kwargs)
The constructor creates a new instance and modifies the *response*
        argument to reflect the error.
The constructor creates a new instance and modifies the *response*
        argument to reflect the error.
The constructor creates a new instance and modifies the * response * argument to reflect the error .
def __init__(self, request, response, code=None, **kwargs):
        """
        The constructor creates a new instance and modifies the *response*
        argument to reflect the error.
        """
        super(httperror, self).__init__(request, response, code, **kwargs)

        # Override HTTPError subclasses
        self.name = "httperror"

        self.request = request
        self.response = response

        if code is not None:
            self.code = code

        self.error = kwargs.get("error", None)

        self.description = kwargs.get(
            "description", getattr(self.__class__, "description", "")
        )

        if self.error is not None:
            self.traceback = "ERROR: (%s) %s\n%s" % (
                self.error[0], self.error[1], "".join(self.error[2])
            )
        else:
            self.traceback = ""

        self.response.close = True
        self.response.status = self.code

        powered_by = POWERED_BY % ({
            "url": SERVER_URL,
            "version": SERVER_VERSION
        }) if getattr(request.server, 'display_banner', False) else ""

        self.data = {
            "code": self.code,
            "name": HTTP_STATUS_CODES.get(self.code, "???"),
            "description": self.description,
            "traceback": escape(self.traceback),
            "powered_by": powered_by
        }
def __init__ ( self , request , response , code = None , * * kwargs ) : super ( httperror , self ) . __init__ ( request , response , code , * * kwargs ) # Override HTTPError subclasses self . name = "httperror" self . request = request self . response = response if code is not None : self . code = code self . error = kwargs . get ( "error" , None ) self . description = kwargs . get ( "description" , getattr ( self . __class__ , "description" , "" ) ) if self . error is not None : self . traceback = "ERROR: (%s) %s\n%s" % ( self . error [ 0 ] , self . error [ 1 ] , "" . join ( self . error [ 2 ] ) ) else : self . traceback = "" self . response . close = True self . response . status = self . code powered_by = POWERED_BY % ( { "url" : SERVER_URL , "version" : SERVER_VERSION } ) if getattr ( request . server , 'display_banner' , False ) else "" self . data = { "code" : self . code , "name" : HTTP_STATUS_CODES . get ( self . code , "???" ) , "description" : self . description , "traceback" : escape ( self . traceback ) , "powered_by" : powered_by }