X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/dba809feb44cd1c4d155f3e3254a1cca5323f95f..aa021ad04c81969c58558343fb1ff2409c82563e:/apps/maintenancemode/middleware.py?ds=inline diff --git a/apps/maintenancemode/middleware.py b/apps/maintenancemode/middleware.py deleted file mode 100644 index 404b1a05..00000000 --- a/apps/maintenancemode/middleware.py +++ /dev/null @@ -1,31 +0,0 @@ -from django.conf import settings -from django.core import urlresolvers - -# This is django-maintancemode v. 0.9.2 - -from django.conf.urls import defaults -defaults.handler503 = 'maintenancemode.views.defaults.temporary_unavailable' -defaults.__all__.append('handler503') - -from maintenancemode.conf.settings import MAINTENANCE_MODE - -class MaintenanceModeMiddleware(object): - def process_request(self, request): - # Allow access if middleware is not activated - if not MAINTENANCE_MODE: - return None - - # Allow access if remote ip is in INTERNAL_IPS - if request.META.get('REMOTE_ADDR') in settings.INTERNAL_IPS: - return None - - # Allow acess if the user doing the request is logged in and a - # staff member. - if hasattr(request, 'user') and request.user.is_staff: - return None - - # Otherwise show the user the 503 page - resolver = urlresolvers.get_resolver(None) - - callback, param_dict = resolver._resolve_special('503') - return callback(request, **param_dict) \ No newline at end of file