Your message dated Fri, 14 Oct 2022 15:49:05 +0000
with message-id <e1ojmvp-0018xq...@fasolo.debian.org>
and subject line Bug#1013510: fixed in django-maintenancemode 0.11.7+git221001-1
has caused the Debian Bug report #1013510,
regarding django-maintenancemode: FTBFS: TypeError: cannot unpack non-iterable 
function object
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
1013510: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1013510
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
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.

--- End Message ---
--- Begin Message ---
Source: django-maintenancemode
Source-Version: 0.11.7+git221001-1
Done: Scott Kitterman <sc...@kitterman.com>

We believe that the bug you reported is fixed in the latest version of
django-maintenancemode, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 1013...@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Scott Kitterman <sc...@kitterman.com> (supplier of updated 
django-maintenancemode package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmas...@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Fri, 14 Oct 2022 11:37:05 -0400
Source: django-maintenancemode
Architecture: source
Version: 0.11.7+git221001-1
Distribution: unstable
Urgency: medium
Maintainer: Debian Python Team <team+pyt...@tracker.debian.org>
Changed-By: Scott Kitterman <sc...@kitterman.com>
Closes: 1013510
Changes:
 django-maintenancemode (0.11.7+git221001-1) unstable; urgency=medium
 .
   * New upstream git snapshot (Closes: #1013510)
   * Delete debian/patches,
     0001-Fix-deprecation-warning-for-django.conf.urls.url.patch and
     0002-Adjust-test-setup-to-work-with-Django-3.patch incorporated upstream
   * Bump standards-version to 4.6.1 without further change
Checksums-Sha1:
 83423809f8d18e2c18263a6e3118695b6559e715 2452 
django-maintenancemode_0.11.7+git221001-1.dsc
 8b0bbae5f61adf82b8842d44bf050798fc245a18 10105 
django-maintenancemode_0.11.7+git221001.orig.tar.gz
 7c15d229f6f9779ad6aac5e2c0633a3843b9c8fd 3720 
django-maintenancemode_0.11.7+git221001-1.debian.tar.xz
 5cf3d0bd2eae38482eaa11a02b988da74dfc2bb9 6576 
django-maintenancemode_0.11.7+git221001-1_source.buildinfo
Checksums-Sha256:
 e0518a39739dcda4d8e46c5659664f03feadd6296a8d7381532748f44f7a9df0 2452 
django-maintenancemode_0.11.7+git221001-1.dsc
 9209eaf065ccfdbcffaf207a8b8d0dfedb93f466d45293ec34bfced35d6c8ce7 10105 
django-maintenancemode_0.11.7+git221001.orig.tar.gz
 ec30cc825857624e2d99e68d2d2b632c3c0ddf9c1ff9c65fe4f98647f628abf0 3720 
django-maintenancemode_0.11.7+git221001-1.debian.tar.xz
 bce3b1d2004f612a2df2fab66c9ccc96a3b18100546baa7e704a414c1e414cd5 6576 
django-maintenancemode_0.11.7+git221001-1_source.buildinfo
Files:
 5dea347ba73b385465d55143622cf60e 2452 python optional 
django-maintenancemode_0.11.7+git221001-1.dsc
 7b1fce95df78463bc9196c97a6b003db 10105 python optional 
django-maintenancemode_0.11.7+git221001.orig.tar.gz
 b24737765b3cd277437d7524951a8c42 3720 python optional 
django-maintenancemode_0.11.7+git221001-1.debian.tar.xz
 5b6235d1ef9dc9de0e0b6a577ce2ff74 6576 python optional 
django-maintenancemode_0.11.7+git221001-1_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE53Kb/76FQA/u7iOxeNfe+5rVmvEFAmNJgkkACgkQeNfe+5rV
mvGngxAAzuZxfuB6Zcj8KjbF3+5WxqdG5t/2cSOmj50mwodoA+F1AAjRKpbnD6V/
YslokEXs083JoXBG5l7u9iStLUPkry1sD5N3R9AtzlQq5YLaSKHqdKfQ9/Zbmq7Q
O3yIYduKp4Rp7qEMyCtYM/bipx2wl7GwSkzDmuTbX7+VXPvWTsb+h5yi2flmKBq7
3p2JuEsuwjiIXo8mSwS/3vnJYLUuc32A+7VTANMcy4wHoGWAt5eZI/eRMCLn/hEc
8X8b4w4V0oqsOFOCxUNcD2qoRaW+FGY0hZIQi+nAKhq7lfb1w1UY/g8vcbmW+fhU
vEi9iFJSJRsfCqJn/r4MpjSi7F9U6Fzw6kG9rpXdQsUMYOTCyNXLQzGzmso3YWvt
37wcH6Oml2+5dfM2XEu7VX6gplEiULTvNNzADEPRgcQEk3MnRolTuLwlF0m8n9P0
Yui0CzFBOqrYRYuE7Pod4duF+CfQorpQzBEtUq5f6wpGC35oiC6K3I61C/5IEYUB
SWRRco2Z/r6M+Zj0Yi8XsOnU8s6fY1tXcfBrCRZfLUTuCzJFNB0N37MbTNv+5o5/
14RF8gXS8cFgtI7iF5V8Qd0/jr85YnP9dB8Ivkonn3jvCazBgACmXML/IuschxpS
6LoXkfNwzBzPhNd4ZxbOvBp2gu7cHhot8xcByHy5v1BNnki3+nA=
=M5Of
-----END PGP SIGNATURE-----

--- End Message ---

Reply via email to