From 5198de65b5bde69bc004bfad51575406179398d7 Mon Sep 17 00:00:00 2001 From: Guilherme Gondim Date: Thu, 20 Nov 2008 16:39:49 +0000 Subject: [PATCH] =?UTF-8?q?Criado=20um=20wrapper=20para=20quem=20n=C3=A3o?= =?UTF-8?q?=20possui=20a=20app=20django-maintenancemode=20instalada.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sigi/middleware.py | 9 +++++++++ sigi/settings.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 sigi/middleware.py diff --git a/sigi/middleware.py b/sigi/middleware.py new file mode 100644 index 0000000..f736951 --- /dev/null +++ b/sigi/middleware.py @@ -0,0 +1,9 @@ +try: + # try use maintenancemode middleware from django-maintenancemode project + import maintenancemode.middleware + class MaintenanceModeMiddleware(maintenancemode.middleware.MaintenanceModeMiddleware): + pass +except ImportError: + # otherwise, a thin wrapper for middleware + class MaintenanceModeMiddleware(object): + pass diff --git a/sigi/settings.py b/sigi/settings.py index 4e91752..bf81d1e 100644 --- a/sigi/settings.py +++ b/sigi/settings.py @@ -64,7 +64,7 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.gzip.GZipMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'maintenancemode.middleware.MaintenanceModeMiddleware', + 'sigi.middleware.MaintenanceModeMiddleware', 'django.middleware.cache.CacheMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.doc.XViewMiddleware',