Created
June 13, 2012 17:30
-
-
Save jsocol/2925392 to your computer and use it in GitHub Desktop.
BannedSession
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BannedSession(Exception): | |
| """For various reasons, mostly in get_response, I don't think you | |
| want to inherit from PermissionDenied.""" | |
| pass | |
| class BannedMiddleware(object): | |
| def process_exception(self, request, exception): | |
| if isinstance(exception, BannedException): | |
| return render(request, 'banned.html', {'reason': exception.args[0]}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment