##// END OF EJS Templates
Don't run time conversion if Intl not available in browser. Also convert...
Don't run time conversion if Intl not available in browser. Also convert thread death time in archived threads

File last commit:

r899:27671c1c default
r1023:0040ea34 default
Show More
middlewares.py
28 lines | 670 B | text/x-python | PythonLexer
from django.shortcuts import redirect
from boards import utils
from boards.models import Ban
RESPONSE_CONTENT_TYPE = 'Content-Type'
TYPE_HTML = 'text/html'
class BanMiddleware:
"""
This is run before showing the thread. Banned users don't need to see
anything
"""
def __init__(self):
pass
def process_view(self, request, view_func, view_args, view_kwargs):
if request.path != '/banned/':
ip = utils.get_client_ip(request)
bans = Ban.objects.filter(ip=ip)
if bans.exists():
ban = bans[0]
if not ban.can_read:
return redirect('banned')