WebHelpers2 icon indicating copy to clipboard operation
WebHelpers2 copied to clipboard

Fix: AttributeError: module 'collections' has no attribute 'Sequence'

Open RemiZOffAlex opened this issue 3 years ago • 1 comments

diff --git a/Makefile b/Makefile
index d55669e84fd0ce65d4f1da8a425de350400a5736..a71d01d2aca660f34e011db8df80c95cd036fbb9 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,3 @@
-python2:
-	python setup.py egg_info -RDb '' sdist bdist_wheel
-
 python3:
 	python3 setup.py egg_info -RDb '' bdist_wheel
 
diff --git a/setup.cfg b/setup.cfg
index d50ae0b7674ae67a02f4cb05ad8773a2651ae250..82f756aa6ed3d93ada2b0bc204b9471f7d252d34 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
 [egg_info]
-tag_build = dev
-tag_date = true
+tag_build =
+tag_date = false
 
 [nosetests]
 verbose=True
diff --git a/setup.py b/setup.py
index 7265056b207fc9ca834d7127655fac1de76d5c46..f8ff1d1921caa5c52428b846c71b5fa60c1a0bdf 100644
--- a/setup.py
+++ b/setup.py
@@ -8,6 +8,10 @@ except ImportError:
     from setuptools import setup, find_packages
 
 from setuptools.command.test import test as TestCommand
+from setuptools.command import sdist
+
+if sys.version_info < (3, 8):
+    raise Exception('Kallithea requires Python 3.8 or later')
 
 from webhelpers2 import __version__
 
diff --git a/webhelpers2/html/tags.py b/webhelpers2/html/tags.py
index 93c1d061af8c04a2dfd6691cabbd51eb3e4926c6..48a3252c77266e85f0d9243cc02344c3fbd7e87f 100644
--- a/webhelpers2/html/tags.py
+++ b/webhelpers2/html/tags.py
@@ -13,6 +13,7 @@ from __future__ import unicode_literals
 import collections
 import datetime
 import logging
+import sys
 import os
 import re
 
@@ -439,7 +440,10 @@ class Options(_OptionsList):
         if values is None:
             return ("",)
         is_string = isinstance(values, six.string_types)
-        is_seq = isinstance(values, collections.Sequence)
+        if sys.version_info >= (3, 10):
+            is_seq = isinstance(values, collections.abc.Sequence)
+        else:
+            is_seq = isinstance(values, collections.Sequence)
         if is_string or not is_seq:
             return (values,)
         else:

RemiZOffAlex avatar Dec 11 '21 21:12 RemiZOffAlex

Fixed in 5674da7.

mikeorr avatar May 04 '23 05:05 mikeorr