def test_it(self): from pyramid.interfaces import IExceptionResponse e = self._makeOne('forbidden') self.assertTrue(IExceptionResponse.providedBy(e)) self.assertEqual(e.status, '403 Forbidden') self.assertEqual(e.message, 'forbidden')
def test_it(self): from pyramid.interfaces import IExceptionResponse e = self._makeOne('notfound') self.assertTrue(IExceptionResponse.providedBy(e)) self.assertEqual(e.status, '404 Not Found') self.assertEqual(e.message, 'notfound')
def commit_veto(request, response, exc_info): if response is None and IExceptionResponse.providedBy( exc_info.exception ): response = exc_info.exception if response is None and exc_info: six.reraise(exc_info.type, exc_info.exception, exc_info.traceback) return response.status.startswith(('4', '5'))
def test_provides_IExceptionResponse(self): from pyramid.interfaces import IExceptionResponse inst = self._getTargetClass()() self.assertTrue(IExceptionResponse.providedBy(inst))