def __init__( self, detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw, ): Response.__init__(self, status="%s %s" % (self.code, self.title), **kw) Exception.__init__(self, detail) if headers: self.headers.extend(headers) self.detail = detail self.comment = comment if body_template is not None: self.body_template = body_template self.body_template_obj = Template(body_template) if self.empty_body: del self.content_type del self.content_length if json_formatter is not None: self.json_formatter = json_formatter
def __init__( self, detail=None, headers=None, comment=None, body_template=None, json_formatter=None, **kw ): Response.__init__(self, status="%s %s" % (self.code, self.title), **kw) Exception.__init__(self, detail) if headers: self.headers.extend(headers) self.detail = detail self.comment = comment if body_template is not None: self.body_template = body_template self.body_template_obj = Template(body_template) if self.empty_body: del self.content_type del self.content_length if json_formatter is not None: self.json_formatter = json_formatter
def __init__(self, detail=None, headers=None, title=None, comment=None, explanation=None, **kw): Response.__init__(self, status='%s %s' % (self.code, self.title), **kw) Exception.__init__(self, detail) if headers: self.headers.extend(headers) self.title = title or self.title self.detail = detail self.comment = comment self.explanation = explanation or self.explanation if self.empty_body: del self.content_type del self.content_length
def __init__(self, msg=u'Not Found.'): body = {'status': 404, 'message': msg} Response.__init__(self, json.dumps(body)) self.status = 404 self.content_type = 'application/json'
def __init__(self, msg=u'Bad request, missing data.'): body = {'status': 400, 'message': msg} Response.__init__(self, json.dumps(body)) self.status = 400 self.content_type = 'application/json'
def __init__(self, msg=u'Unauthorized'): body = {'status': 401, 'message': msg} Response.__init__(self, json.dumps(body)) self.status = 401 self.content_type = 'application/json'
def __init__(self, message='Exception'): Response.__init__(self, status=self.status) Exception.__init__(self, message)
def __init__(self, message='Exception'): Response.__init__(self, status=self.status) Exception.__init__(self, message)