From c8e689712af589bc261adc97b157f6d8cf867860 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 2 Oct 2019 18:11:26 -0500 Subject: [PATCH] Add `forbidden()` convenience method to core View class --- tailbone/views/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tailbone/views/core.py b/tailbone/views/core.py index 1a90b841..7e7a7cee 100644 --- a/tailbone/views/core.py +++ b/tailbone/views/core.py @@ -72,6 +72,12 @@ class View(object): """ return getattr(self.request, 'rattail_config', None) + def forbidden(self): + """ + Convenience method, to raise a HTTP 403 Forbidden exception. + """ + return httpexceptions.HTTPForbidden() + def notfound(self): return httpexceptions.HTTPNotFound()