##// END OF EJS Templates
Fixed loading previews of OPs in bumplimit
Fixed loading previews of OPs in bumplimit

File last commit:

r340:1472a0a6 default
r378:57d21b81 default
Show More
middlewares.py
18 lines | 582 B | text/x-python | PythonLexer
neko259
Added ban middleware. Now banned user's won't cause load to the server.
r210 from django.shortcuts import redirect
from boards import views, utils
from boards.models import Ban
class BanMiddleware:
"""This is run before showing the thread. Banned users don't need to see
anything"""
def process_view(self, request, view_func, view_args, view_kwargs):
if view_func != views.you_are_banned:
ip = utils.get_client_ip(request)
neko259
Added ban reasons. Added write-only bans.
r340 bans = Ban.objects.filter(ip=ip)
neko259
Added ban middleware. Now banned user's won't cause load to the server.
r210
neko259
Added ban reasons. Added write-only bans.
r340 if bans.exists():
ban = bans[0]
if not ban.can_read:
return redirect(views.you_are_banned)