Skip to content

Instantly share code, notes, and snippets.

@groovecoder
Created June 13, 2012 19:19
Show Gist options
  • Save groovecoder/2925901 to your computer and use it in GitHub Desktop.
Save groovecoder/2925901 to your computer and use it in GitHub Desktop.
import jingo
from wiki import ReadOnlyException
class ReadOnlyMiddleware(object):
"""
Renders a 403.html page with a flag for a specific message.
"""
def process_exception(self, request, exception):
import pdb; pdb.set_trace()
if isinstance(exception, ReadOnlyException):
return jingo.render(request, 'handlers/403.html',
{'reason': exception.args[0]},
status=403)
return None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment