Пример #1
0
 def __init__(self, msg="", content_type=None):
     self.msg = msg
     response = Response(404, stream=msg)
     if content_type is None:
         content_type = http_headers.MimeType("text", "plain")
     response.headers.setHeader("content-type", content_type)
     HTTPError.__init__(self, response)
Пример #2
0
 def __init__(self, phrase=None, comment=''):
     if phrase is not None:
         self.phrase = phrase
     if comment:
         self.comment = '<!--\n' + str(comment).replace('-->', '--&gt;') + '\n-->'
     else:
         self.comment = ''
     self.response = XMLErrorResponse(self.code, self.build_xml_output())
     HTTPError.__init__(self, self.response)