python-mailman/support-sqlalchemy-1-4.patch
2022-09-27 22:45:07 +00:00

69 lines
3.0 KiB
Diff

Index: mailman-3.3.5/setup.py
===================================================================
--- mailman-3.3.5.orig/setup.py
+++ mailman-3.3.5/setup.py
@@ -127,7 +127,7 @@ case second 'm'. Any other spelling is
'python-dateutil>=2.0',
'passlib',
'requests',
- 'sqlalchemy>=1.2.3,<1.4',
+ 'sqlalchemy>=1.2.3,<1.5',
'zope.component',
'zope.configuration',
'zope.event',
Index: mailman-3.3.5/src/mailman/database/tests/test_factory.py
===================================================================
--- mailman-3.3.5.orig/src/mailman/database/tests/test_factory.py
+++ mailman-3.3.5/src/mailman/database/tests/test_factory.py
@@ -76,10 +76,11 @@ class TestSchemaManager(unittest.TestCas
# In case of MySQL, you cannot create/drop indexes on primary keys
# manually as it is handled automatically by MySQL.
if not is_mysql(config.db.engine):
- Index('ix_user__user_id').drop(bind=config.db.engine)
# Don't pollute our main metadata object, create a new one.
md = MetaData()
user_table = Model.metadata.tables['user'].tometadata(md)
+ Index('ix_user__user_id', user_table.c._user_id).drop(
+ bind=config.db.engine)
Index('ix_user_user_id', user_table.c._user_id).create(
bind=config.db.engine)
config.db.commit()
@@ -98,7 +99,11 @@ class TestSchemaManager(unittest.TestCas
# indexes for primary keys, don't try doing it with that backend.
if not is_mysql(config.db.engine):
with suppress(ProgrammingError, OperationalError):
- Index('ix_user_user_id').drop(bind=config.db.engine)
+ # Don't pollute our main metadata object, create a new one.
+ md = MetaData()
+ user_table = Model.metadata.tables['user'].tometadata(md)
+ Index('ix_user_user_id', user_table.c._user_id).drop(
+ bind=config.db.engine)
config.db.commit()
def test_current_database(self):
Index: mailman-3.3.5/src/mailman/model/listmanager.py
===================================================================
--- mailman-3.3.5.orig/src/mailman/model/listmanager.py
+++ mailman-3.3.5/src/mailman/model/listmanager.py
@@ -31,6 +31,11 @@ from mailman.model.mime import ContentFi
from mailman.utilities.datetime import now
from mailman.utilities.queries import QuerySequence
from public import public
+try:
+ from sqlalchemy.engine import Row
+except ImportError:
+ from sqlalchemy.engine import RowProxy as Row
+
from zope.event import notify
from zope.interface import implementer
@@ -120,7 +125,7 @@ class ListManager:
"""See `IListManager`."""
result_set = store.query(MailingList)
for list_id in result_set.values(MailingList._list_id):
- assert isinstance(list_id, tuple) and len(list_id) == 1
+ assert isinstance(list_id, (tuple, Row)) and len(list_id) == 1
yield list_id[0]
@property