From bfed8ea9419940a244750f57ca8318b2689b7271 Mon Sep 17 00:00:00 2001 From: Mike Pirnat Date: Tue, 12 Jun 2012 15:28:02 -0400 Subject: [PATCH] Adds support for draft HTTP error code '451: Unavailable For Legal Reasons' --- webob/exc.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/webob/exc.py b/webob/exc.py index fae02155..bc22ae65 100644 --- a/webob/exc.py +++ b/webob/exc.py @@ -960,6 +960,25 @@ class HTTPRequestHeaderFieldsTooLarge(HTTPClientError): explanation = ( 'The request header fields were too large') +class HTTPUnavailableForLegalReasons(HTTPClientError): + """ + subclass of :class:`~HTTPClientError` + + This indicates that the server is unable to process the request + because of legal reasons, e.g. censorship or government-mandated + blocked access. + + From the draft "A New HTTP Status Code for Legally-restricted Resources" + by Tim Bray: + + http://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00 + + code: 451, title: Unavailable For Legal Reasons + """ + code = 451 + title = 'Unavailable For Legal Reasons' + explanation = ('The resource is not available due to legal reasons.') + ############################################################ ## 5xx Server Error ############################################################