Files
modoboa/lib/middleware.py
T
Antoine Nguyen 9cde410ae4 * Many changes about internationalization (using gettext_noop when needed for example)
* Some strings were not detected by makemessages (for example in javascript files, behind comments...). There are still some issues with that but I think I'll have to wait a future Django release.
* Support for per-user language selection is almost done.

see #166
2011-09-14 14:18:46 +02:00

18 lines
489 B
Python

# -*- coding: utf-8 -*-
import re
from django.http import Http404
from modoboa.admin.models import Extension
class ExtControlMiddleware(object):
def process_view(self, request, view, args, kwargs):
m = re.match("modoboa\.extensions\.(\w+)", view.__module__)
if m is None:
return None
ext = Extension.objects.get(name=m.group(1))
if ext is None:
return None
if ext.enabled:
return None
raise Http404