At last, ticket #48 is done! It's really going to simplify installation and management.

This commit is contained in:
tonio
2010-10-25 14:50:16 +02:00
parent 95991756c5
commit 6719ab274f
13 changed files with 307 additions and 17 deletions
+5
View File
@@ -77,6 +77,11 @@ def is_not_localadmin(errortpl="error"):
% {"user" : request.user.username})
})
return f(request, *args, **kwargs)
wrapped_f.__name__ = f.__name__
wrapped_f.__dict__ = f.__dict__
wrapped_f.__doc__ = f.__doc__
wrapped_f.__module__ = f.__module__
return wrapped_f
return dec
+19
View File
@@ -0,0 +1,19 @@
# -*- 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