Esempio n. 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)
Esempio n. 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, "")
Esempio n. 3
0
 def __init__(self):
     status = "201 Created"
     headers = {'Content-Type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Esempio n. 4
0
 def __init__(self):
     status = "403 Forbidden"
     headers = {'Content-Type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Esempio n. 5
0
 def __init__(self):
     status = "401 Unauthorized"
     headers = {'Content-type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Esempio n. 6
0
 def __init__(self):
     status = "401 Bad Request"
     headers = {'Content-type': 'application/json'}
     HTTPError.__init__(self, status, headers, self.message)
Esempio n. 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))
Esempio n. 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))
Esempio n. 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))
Esempio n. 12
0
 def __init__(self, log_message=None):
     HTTPError.__init__(self, 400, log_message)
Esempio n. 13
0
 def __init__(self, message):
     status = '500 Internal Server Error'
     headers = {'Content-Type': 'text/html'}
     HTTPError.__init__(self, status, headers, message)
Esempio n. 14
0
 def __init__(self, message):
     status = '500 Internal Server Error'
     headers = {'Content-Type': 'text/html'}
     HTTPError.__init__(self, status, headers, message)
Esempio n. 15
0
 def __init__(self, log_message=None):
     HTTPError.__init__(self, 400, log_message)