Пример #1
0
 def __init__(self):
     status = status = HTTP_STATUS_CODES[406]
     headers = {
         'Cache-Control': 'no-cache',
         'Content-Type': 'application/json'
     }
     HTTPError.__init__(self, status, headers, self.message)
Пример #2
0
  def __init__(self, url, status='303 See Other'):
    """
    Returns a `status` redirect to the new URL. 
    `url` is joined with the base URL so that things like 
    `redirect("about") will work properly.
    """
    newloc = urlparse.urljoin(web.ctx.path, url)

    newloc = ctx.homedomain + newloc

    headers = {
      'Content-Type': 'text/html',
      'Location': newloc
    }
    HTTPError.__init__(self, status, headers, "")
Пример #3
0
 def __init__(self):
     status = "201 Created"
     headers = {'Content-Type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Пример #4
0
 def __init__(self):
     status = "403 Forbidden"
     headers = {'Content-Type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Пример #5
0
 def __init__(self):
     status = "401 Unauthorized"
     headers = {'Content-type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Пример #6
0
 def __init__(self):
     status = "401 Bad Request"
     headers = {'Content-type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Пример #7
0
 def __init__(self, message=None):
   status = "405 Method Not Allowed"
   headers = {
     "Content-Type": "application/json; charset=UTF-8"
   }
   HTTPError.__init__(self, status, headers, jsonEncode(message or self.message))
Пример #8
0
 def __init__(self, status, message=None):
     headers = {'Content-Type': 'text/html'}
     HTTPError.__init__(self, status, headers, message or self.message)
 def __init__(self, message=None):
     status = "405 Method Not Allowed"
     headers = {"Content-Type": "application/json; charset=UTF-8"}
     HTTPError.__init__(self, status, headers,
                        encodeJson(message or self.message))
Пример #10
0
 def __init__(self, message=None):
   status = "403 Forbidden"
   headers = {
     "Content-Type": "application/json; charset=UTF-8"
   }
   HTTPError.__init__(self, status, headers, encodeJson(message or self.message))
 def __init__(self, message=None):
   status = "400 Bad Request"
   headers = {
     "Content-Type": "application/json; charset=UTF-8"
   }
   HTTPError.__init__(self, status, headers, jsonEncode(message or self.message))
Пример #12
0
 def __init__(self, log_message=None):
     HTTPError.__init__(self, 400, log_message)
Пример #13
0
 def __init__(self, message):
     status = '500 Internal Server Error'
     headers = {'Content-Type': 'text/html'}
     HTTPError.__init__(self, status, headers, message)
Пример #14
0
 def __init__(self, message):
     status = '500 Internal Server Error'
     headers = {'Content-Type': 'text/html'}
     HTTPError.__init__(self, status, headers, message)
Пример #15
0
 def __init__(self, log_message=None):
     HTTPError.__init__(self, 400, log_message)