From 95b36fc8436f18aab7cb91249735d9de5e23713b Mon Sep 17 00:00:00 2001 From: Peter Marheine Date: Thu, 23 Dec 2021 10:27:14 +1100 Subject: [PATCH] Import ABCs from collections.abc, not collections The types in collections.abc were moved from just collections in Python 3.3, and Python 3.10 removed the old aliases. We no longer support Python versions earlier than 3.3 and need to support 3.10, so update the import. --- django_downloadview/middlewares.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django_downloadview/middlewares.py b/django_downloadview/middlewares.py index 557498d..51888b2 100644 --- a/django_downloadview/middlewares.py +++ b/django_downloadview/middlewares.py @@ -4,7 +4,7 @@ Download middlewares capture :py:class:`django_downloadview.DownloadResponse` responses and may replace them with optimized download responses. """ -import collections +import collections.abc import copy import os @@ -160,7 +160,7 @@ class SmartDownloadMiddleware(BaseDownloadMiddleware): for key, options in enumerate(options_list): args = [] kwargs = {} - if isinstance(options, collections.Mapping): # Using kwargs. + if isinstance(options, collections.abc.Mapping): # Using kwargs. kwargs = options else: args = options