Mark Sapiro pushed to branch master at GNU Mailman / Mailman Core
Commits: 01e871cb by Mark Sapiro at 2021-04-29T05:58:16+00:00 Changed mailinglist info column to Text type. - - - - - 57eb5a4a by Mark Sapiro at 2021-04-29T05:58:17+00:00 Merge branch 'info' into 'master' Changed mailinglist info column to Text type. Closes #886 and #840 See merge request mailman/mailman!846 - - - - - 4 changed files: - + src/mailman/database/alembic/versions/ec5fe422e27c_increase_info.py - src/mailman/database/types.py - src/mailman/docs/NEWS.rst - src/mailman/model/mailinglist.py Changes: ===================================== src/mailman/database/alembic/versions/ec5fe422e27c_increase_info.py ===================================== @@ -0,0 +1,43 @@ +# Copyright (C) 2020-2021 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <https://www.gnu.org/licenses/>. + +"""increase_info + +Revision ID: ec5fe422e27c +Revises: 472e6d713047 +Create Date: 2021-04-28 17:46:28.879085 + +""" + +from alembic import op +from mailman.database.types import SAText, SAUnicode + + +# revision identifiers, used by Alembic. +revision = 'ec5fe422e27c' +down_revision = '472e6d713047' + + +def upgrade(): + # Mailing List info column needs to be bigger. + with op.batch_alter_table('mailinglist') as batch_op: + batch_op.alter_column('info', type_=SAText) + + +def downgrade(): + with op.batch_alter_table('mailinglist') as batch_op: + batch_op.alter_column('info', type_=SAUnicode) ===================================== src/mailman/database/types.py ===================================== @@ -23,7 +23,7 @@ from public import public from sqlalchemy import Integer from sqlalchemy.dialects import postgresql from sqlalchemy.ext.compiler import compiles -from sqlalchemy.types import CHAR, TypeDecorator, Unicode +from sqlalchemy.types import CHAR, Text, TypeDecorator, Unicode @public @@ -150,3 +150,24 @@ def compile_sa_unicode_xl(element, compiler, **kw): @compiles(SAUnicodeXL) def default_sa_unicode_xl(element, compiler, **kw): return compiler.visit_unicode(element, **kw) + + +@public +class SAText(TypeDecorator): + """Text datatype to support large text content in MySQL. + + This type compiles to TEXT COLLATE utf8_bin in case of MySQL, and in + case of other dialects defaults to the Text type. + """ + impl = Text + + +@compiles(SAText) +def default_sa_text(element, compiler, **kw): + return compiler.visit_text(element, **kw) + + +@compiles(SAText, 'mysql') +def compile_sa_text(element, compiler, **kw): + # We hardcode the collate here to make string comparison case sensitive. + return 'TEXT COLLATE utf8_bin' # pragma: nocover ===================================== src/mailman/docs/NEWS.rst ===================================== @@ -54,6 +54,8 @@ Bugs subject before processing it.(Closes #858) * Command runner now will decode the message body before processing it. (Closes #859) +* The ``mailinglist`` table ``info`` column is changed to Text. (Closes #840 + and #886) Command line ------------ ===================================== src/mailman/model/mailinglist.py ===================================== @@ -22,7 +22,7 @@ import os from mailman.config import config from mailman.database.model import Model from mailman.database.transaction import dbconnection -from mailman.database.types import Enum, SAUnicode, SAUnicodeLarge +from mailman.database.types import Enum, SAText, SAUnicode, SAUnicodeLarge from mailman.interfaces.action import Action, FilterAction from mailman.interfaces.address import IAddress, InvalidEmailAddressError from mailman.interfaces.archiver import ArchivePolicy @@ -153,7 +153,7 @@ class MailingList(Model): gateway_to_mail = Column(Boolean) gateway_to_news = Column(Boolean) hold_these_nonmembers = Column(MutableList.as_mutable(PickleType)) - info = Column(SAUnicode) + info = Column(SAText) linked_newsgroup = Column(SAUnicode) max_days_to_hold = Column(Integer) max_message_size = Column(Integer) View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/b87ca1217402e70d0eceb499c7db97540f746b9e...57eb5a4aaf86ad0ff85105ae406aa752204b6bd1 -- View it on GitLab: https://gitlab.com/mailman/mailman/-/compare/b87ca1217402e70d0eceb499c7db97540f746b9e...57eb5a4aaf86ad0ff85105ae406aa752204b6bd1 You're receiving this email because of your account on gitlab.com.
_______________________________________________ Mailman-checkins mailing list -- mailman-checkins@python.org To unsubscribe send an email to mailman-checkins-le...@python.org https://mail.python.org/mailman3/lists/mailman-checkins.python.org/ Member address: arch...@jab.org