def badRequestError(self, name): if re.match('^[A-Z_0-9]+$', name): self.setStatus(500) exc = InternalError(name) exc.title = 'Internal Error' exc.detail = 'Sorry, an internal error occurred in this resource.' raise exc self.setStatus(400) exc = BadRequest(name) exc.title = 'Invalid request' exc.detail = ('The parameter, <em>%s</em>, ' 'was omitted from the request.<p>' 'Make sure to specify all required parameters, ' 'and try the request again.</p>' % name) raise exc
def badRequestError(self, name): if re.match('^[A-Z_0-9]+$', name): self.setStatus(500) exc = InternalError(name) exc.title = 'Internal Error' exc.detail = 'Sorry, an internal error occurred in this resource.' raise exc self.setStatus(400) exc = BadRequest(name) exc.title = 'Invalid request' exc.detail = ( 'The parameter, <em>%s</em>, ' 'was omitted from the request.<p>' 'Make sure to specify all required parameters, ' 'and try the request again.</p>' % name) raise exc
def catch_all_response(self, exc): response = InternalError() response.detail = repr(exc) return response