Source: django-maintenancemode Version: 0.11.7-1 Severity: serious Justification: FTBFS Tags: bookworm sid ftbfs User: lu...@debian.org Usertags: ftbfs-20220624 ftbfs-bookworm
Hi, During a rebuild of all packages in sid, your package failed to build on amd64. Relevant part (hopefully): > make[1]: Entering directory '/<<PKGBUILDDIR>>' > dh_auto_test -- --system=custom --test-args="PYTHONPATH=. {interpreter} -m > pytest" > I: pybuild base:239: PYTHONPATH=. python3.9 -m pytest > ============================= test session starts > ============================== > platform linux -- Python 3.9.13, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 > Django settings: maintenancemode.tests.settings (from ini file) > rootdir: /<<PKGBUILDDIR>>, configfile: setup.cfg > plugins: django-3.5.1 > collected 13 items > > maintenancemode/tests/test_middleware.py ..FF.F..F.F.F > [100%] > > =================================== FAILURES > =================================== > ___ MaintenanceModeMiddlewareTestCase.test_enabled_middleware_with_template > ____ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_enabled_middleware_with_template> > > def test_enabled_middleware_with_template(self): > # Enabling the middleware having a ``503.html`` in any of the > # template locations should return the rendered template" > with self.settings(MAINTENANCE_MODE=True): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:52: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > __ MaintenanceModeMiddlewareTestCase.test_enabled_middleware_without_template > __ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_enabled_middleware_without_template> > > def test_enabled_middleware_without_template(self): > # Enabling the middleware without a proper 503 template should > # raise a template error > with self.settings(MAINTENANCE_MODE=True, TEMPLATES=[]): > > self.assertRaises(TemplateDoesNotExist, self.client.get, "/") > > maintenancemode/tests/test_middleware.py:46: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > __________ MaintenanceModeMiddlewareTestCase.test_management_command > ___________ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_management_command> > > def test_management_command(self): > out = StringIO() > # Explicitly disabling the ``MAINTENANCE_MODE`` > with self.settings(MAINTENANCE_MODE=False): > management.call_command("maintenance", "on", stdout=out) > > self.assertContains(self.client.get("/"), text="Temporary > > unavailable", count=1, status_code=503) > > maintenancemode/tests/test_middleware.py:142: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > ____ MaintenanceModeMiddlewareTestCase.test_middleware_with_non_staff_user > _____ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_middleware_with_non_staff_user> > > def test_middleware_with_non_staff_user(self): > # A logged in user that is not a staff user should see the 503 message > self.client.login(username="maintenance", password="password") > > with self.settings(MAINTENANCE_MODE=True): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:61: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > ___ MaintenanceModeMiddlewareTestCase.test_middleware_with_staff_user_denied > ___ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_middleware_with_staff_user_denied> > > def test_middleware_with_staff_user_denied(self): > # A logged in user that _is_ a staff user should be able to > # use the site normally > User.objects.filter(pk=self.user.pk).update(is_staff=True) > > self.client.login(username="maintenance", password="password") > > with self.settings(MAINTENANCE_MODE=True, > MAINTENANCE_ALLOW_STAFF=False): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:83: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > _ > MaintenanceModeMiddlewareTestCase.test_middleware_with_superuser_user_denied _ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_middleware_with_superuser_user_denied> > > def test_middleware_with_superuser_user_denied(self): > # A logged in user that _is_ a staff user should be able to > # use the site normally > User.objects.filter(pk=self.user.pk).update(is_superuser=True) > > self.client.login(username="maintenance", password="password") > > with self.settings(MAINTENANCE_MODE=True, > MAINTENANCE_ALLOW_SUPERUSER=False): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:94: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > =============================== warnings summary > =============================== > ../../../usr/lib/python3/dist-packages/django/conf/__init__.py:206 > /usr/lib/python3/dist-packages/django/conf/__init__.py:206: > RemovedInDjango50Warning: The default value of USE_TZ will change from False > to True in Django 5.0. Set USE_TZ to False in your project settings if you > want to keep the current default behavior. > warnings.warn( > > -- Docs: https://docs.pytest.org/en/stable/warnings.html > =========================== short test summary info > ============================ > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_enabled_middleware_with_template > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_enabled_middleware_without_template > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_management_command > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_middleware_with_non_staff_user > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_middleware_with_staff_user_denied > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_middleware_with_superuser_user_denied > ==================== 6 failed, 7 passed, 1 warning in 4.60s > ==================== > E: pybuild pybuild:369: test: plugin custom failed with: exit code=1: > PYTHONPATH=. python3.9 -m pytest > I: pybuild base:239: PYTHONPATH=. python3.10 -m pytest > ============================= test session starts > ============================== > platform linux -- Python 3.10.5, pytest-6.2.5, py-1.10.0, pluggy-1.0.0 > Django settings: maintenancemode.tests.settings (from ini file) > rootdir: /<<PKGBUILDDIR>>, configfile: setup.cfg > plugins: django-3.5.1 > collected 13 items > > maintenancemode/tests/test_middleware.py ..FF.F..F.F.F > [100%] > > =================================== FAILURES > =================================== > ___ MaintenanceModeMiddlewareTestCase.test_enabled_middleware_with_template > ____ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_enabled_middleware_with_template> > > def test_enabled_middleware_with_template(self): > # Enabling the middleware having a ``503.html`` in any of the > # template locations should return the rendered template" > with self.settings(MAINTENANCE_MODE=True): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:52: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > __ MaintenanceModeMiddlewareTestCase.test_enabled_middleware_without_template > __ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_enabled_middleware_without_template> > > def test_enabled_middleware_without_template(self): > # Enabling the middleware without a proper 503 template should > # raise a template error > with self.settings(MAINTENANCE_MODE=True, TEMPLATES=[]): > > self.assertRaises(TemplateDoesNotExist, self.client.get, "/") > > maintenancemode/tests/test_middleware.py:46: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > __________ MaintenanceModeMiddlewareTestCase.test_management_command > ___________ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_management_command> > > def test_management_command(self): > out = StringIO() > # Explicitly disabling the ``MAINTENANCE_MODE`` > with self.settings(MAINTENANCE_MODE=False): > management.call_command("maintenance", "on", stdout=out) > > self.assertContains(self.client.get("/"), text="Temporary > > unavailable", count=1, status_code=503) > > maintenancemode/tests/test_middleware.py:142: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > ____ MaintenanceModeMiddlewareTestCase.test_middleware_with_non_staff_user > _____ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_middleware_with_non_staff_user> > > def test_middleware_with_non_staff_user(self): > # A logged in user that is not a staff user should see the 503 message > self.client.login(username="maintenance", password="password") > > with self.settings(MAINTENANCE_MODE=True): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:61: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > ___ MaintenanceModeMiddlewareTestCase.test_middleware_with_staff_user_denied > ___ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_middleware_with_staff_user_denied> > > def test_middleware_with_staff_user_denied(self): > # A logged in user that _is_ a staff user should be able to > # use the site normally > User.objects.filter(pk=self.user.pk).update(is_staff=True) > > self.client.login(username="maintenance", password="password") > > with self.settings(MAINTENANCE_MODE=True, > MAINTENANCE_ALLOW_STAFF=False): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:83: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > _ > MaintenanceModeMiddlewareTestCase.test_middleware_with_superuser_user_denied _ > > self = > <maintenancemode.tests.test_middleware.MaintenanceModeMiddlewareTestCase > testMethod=test_middleware_with_superuser_user_denied> > > def test_middleware_with_superuser_user_denied(self): > # A logged in user that _is_ a staff user should be able to > # use the site normally > User.objects.filter(pk=self.user.pk).update(is_superuser=True) > > self.client.login(username="maintenance", password="password") > > with self.settings(MAINTENANCE_MODE=True, > MAINTENANCE_ALLOW_SUPERUSER=False): > > response = self.client.get("/") > > maintenancemode/tests/test_middleware.py:94: > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > /usr/lib/python3/dist-packages/django/test/client.py:836: in get > response = super().get(path, data=data, secure=secure, **extra) > /usr/lib/python3/dist-packages/django/test/client.py:424: in get > return self.generic( > /usr/lib/python3/dist-packages/django/test/client.py:541: in generic > return self.request(**r) > /usr/lib/python3/dist-packages/django/test/client.py:810: in request > self.check_exception(response) > /usr/lib/python3/dist-packages/django/test/client.py:663: in check_exception > raise exc_value > /usr/lib/python3/dist-packages/django/core/handlers/exception.py:55: in inner > response = get_response(request) > /usr/lib/python3/dist-packages/django/utils/deprecation.py:133: in __call__ > response = self.process_request(request) > _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ > _ > > self = <MaintenanceModeMiddleware get_response=BaseHandler._get_response> > request = <WSGIRequest: GET '/'> > > def process_request(self, request): > # Allow access if middleware is not activated > allow_staff = getattr(settings, "MAINTENANCE_ALLOW_STAFF", True) > allow_superuser = getattr(settings, "MAINTENANCE_ALLOW_SUPERUSER", > True) > > if not (settings.MAINTENANCE_MODE or maintenance.status()): > return None > > INTERNAL_IPS = maintenance.IPList(settings.INTERNAL_IPS) > > # Preferentially check HTTP_X_FORWARDED_FOR b/c a proxy > # server might have obscured REMOTE_ADDR > for ip in request.META.get("HTTP_X_FORWARDED_FOR", "").split(","): > if ip.strip() in INTERNAL_IPS: > return None > > # Allow access if remote ip is in INTERNAL_IPS > if request.META.get("REMOTE_ADDR") in INTERNAL_IPS: > return None > > # Allow access if the user doing the request is logged in and a > # staff member. > if hasattr(request, "user"): > if allow_staff and request.user.is_staff: > return None > > if allow_superuser and request.user.is_superuser: > return None > > # Check if a path is explicitly excluded from maintenance mode > for url in IGNORE_URLS: > if url.match(request.path_info): > return None > # Otherwise show the user the 503 page > > if DJANGO_VERSION_MAJOR >= 3 and DJANGO_VERSION_MINOR >= 2: > # Checks if DJANGO version is great than 3.2.0 for breaking change > resolver = resolvers.get_resolver(None) > resolve = resolver.resolve_error_handler > callback = resolve('503') > > return callback(request) > else: > resolver = get_resolver() > > > callback, param_dict = resolver.resolve_error_handler("503") > E TypeError: cannot unpack non-iterable function object > > maintenancemode/middleware.py:66: TypeError > ------------------------------ Captured log call > ------------------------------- > ERROR django.request:log.py:241 Internal Server Error: / > Traceback (most recent call last): > File "/usr/lib/python3/dist-packages/django/core/handlers/exception.py", > line 55, in inner > response = get_response(request) > File "/usr/lib/python3/dist-packages/django/utils/deprecation.py", line > 133, in __call__ > response = self.process_request(request) > File "/<<PKGBUILDDIR>>/maintenancemode/middleware.py", line 66, in > process_request > callback, param_dict = resolver.resolve_error_handler("503") > TypeError: cannot unpack non-iterable function object > =============================== warnings summary > =============================== > ../../../usr/lib/python3/dist-packages/django/conf/__init__.py:206 > /usr/lib/python3/dist-packages/django/conf/__init__.py:206: > RemovedInDjango50Warning: The default value of USE_TZ will change from False > to True in Django 5.0. Set USE_TZ to False in your project settings if you > want to keep the current default behavior. > warnings.warn( > > -- Docs: https://docs.pytest.org/en/stable/warnings.html > =========================== short test summary info > ============================ > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_enabled_middleware_with_template > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_enabled_middleware_without_template > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_management_command > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_middleware_with_non_staff_user > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_middleware_with_staff_user_denied > FAILED > maintenancemode/tests/test_middleware.py::MaintenanceModeMiddlewareTestCase::test_middleware_with_superuser_user_denied > ==================== 6 failed, 7 passed, 1 warning in 4.70s > ==================== > E: pybuild pybuild:369: test: plugin custom failed with: exit code=1: > PYTHONPATH=. python3.10 -m pytest > dh_auto_test: error: pybuild --test -i python{version} -p "3.9 3.10" > --system=custom "--test-args=PYTHONPATH=. {interpreter} -m pytest" returned > exit code 13 The full build log is available from: http://qa-logs.debian.net/2022/06/24/django-maintenancemode_0.11.7-1_unstable.log All bugs filed during this archive rebuild are listed at: https://bugs.debian.org/cgi-bin/pkgreport.cgi?tag=ftbfs-20220624;users=lu...@debian.org or: https://udd.debian.org/bugs/?release=na&merged=ign&fnewerval=7&flastmodval=7&fusertag=only&fusertagtag=ftbfs-20220624&fusertaguser=lu...@debian.org&allbugs=1&cseverity=1&ctags=1&caffected=1#results A list of current common problems and possible solutions is available at http://wiki.debian.org/qa.debian.org/FTBFS . You're welcome to contribute! If you reassign this bug to another package, please marking it as 'affects'-ing this package. See https://www.debian.org/Bugs/server-control#affects If you fail to reproduce this, please provide a build log and diff it with mine so that we can identify if something relevant changed in the meantime.