fix
[prawokultury.git] / prawokultury / middleware.py
1 from honeypot.middleware import HoneypotViewMiddleware
2
3 def honeypot_exempt(view):
4     view.honeypot_exempt = True
5     return view
6
7 class ExemptableHoneypotViewMiddleware(HoneypotViewMiddleware):
8     def process_view(self, request, callback, callback_args, callback_kwargs):
9         if hasattr(callback, 'honeypot_exempt'):
10             return None
11         return super(ExemptableHoneypotViewMiddleware, self).process_view(
12             request, callback, callback_args, callback_kwargs)