summaryrefslogtreecommitdiff
path: root/src/mailman/database
diff options
context:
space:
mode:
authorBarry Warsaw2012-12-30 14:39:10 -0500
committerBarry Warsaw2012-12-30 14:39:10 -0500
commita0244a524117c90cbf22f0007b96933c4fb2aa4b (patch)
tree21fc100ba690971aa1310fb08c82fedc5f38084c /src/mailman/database
parent2450a9c9642d06af1a60df70acb742e67959d77e (diff)
parent5ec8a131c602f9b00d6b25d914ffc923cd1aa964 (diff)
downloadmailman-a0244a524117c90cbf22f0007b96933c4fb2aa4b.tar.gz
mailman-a0244a524117c90cbf22f0007b96933c4fb2aa4b.tar.zst
mailman-a0244a524117c90cbf22f0007b96933c4fb2aa4b.zip
* List styles are supported through the REST API. Get the list of available
styles (by name) via `.../lists/styles`. Create a list in a specific style by using POST data `style_name=<style>`. (LP: #975692) * The default list style is renamed to `legacy-default` and a new `legacy-announce` style is added. This is similar to the `legacy-default` except set up for announce-only lists. * The following columns were unused and have been removed: - `mailinglist.new_member_options` - `mailinglist.send_reminders` - `mailinglist.subscribe_policy` - `mailinglist.unsubscribe_policy` - `mailinglist.subscribe_auto_approval` - `mailinglist.private_roster` - `mailinglist.admin_member_chunksize` Also: * List styles no longer have a priority, nor is there any style matching any more. Now, exactly one named style (either explicitly through the `create_list()` function, or by default from the configuration file) is applied to a list at list creation time. * The huge old DefaultStyle is now decomposed into smaller units. An announce-like style is added. * `find_components()` and `scan_module()` moved from `app/finder.py` to `utilities/modules.py`. * Lots of doctest rewriting for better documentation. Bad-path tests moved to unittests. * `create_list()` now takes an optional `style_name` parameter. If not given, `[styles]default` is used. * `create_list()` doesn't set the `personalize` or `display_name` attributes any more. These are already set in styles. * Removed an unnecessary `tearDown()`. * Added some improvements on displaying lists in JSON responses.
Diffstat (limited to 'src/mailman/database')
-rw-r--r--src/mailman/database/schema/mm_20121015000000.py21
-rw-r--r--src/mailman/database/schema/sqlite_20120407000000_01.sql2
-rw-r--r--src/mailman/database/schema/sqlite_20121015000000_01.sql208
-rw-r--r--src/mailman/database/tests/test_migrations.py31
4 files changed, 255 insertions, 7 deletions
diff --git a/src/mailman/database/schema/mm_20121015000000.py b/src/mailman/database/schema/mm_20121015000000.py
index 51e0602e7..dc688d33b 100644
--- a/src/mailman/database/schema/mm_20121015000000.py
+++ b/src/mailman/database/schema/mm_20121015000000.py
@@ -17,7 +17,12 @@
"""3.0b2 -> 3.0b3 schema migrations.
-* bans.mailing_list -> bans.list_id
+Renamed:
+ * bans.mailing_list -> bans.list_id
+
+Removed:
+ * mailinglist.new_member_options
+ * mailinglist.send_remindersn
"""
from __future__ import absolute_import, print_function, unicode_literals
@@ -65,9 +70,12 @@ def upgrade_sqlite(database, store, version, module_path):
UPDATE ban_backup SET list_id = '{0}'
WHERE id = {1};
""".format(_make_listid(mailing_list), id))
- # Pivot the backup table to the real thing.
+ # Pivot the bans backup table to the real thing.
store.execute('DROP TABLE ban;')
store.execute('ALTER TABLE ban_backup RENAME TO ban;')
+ # Pivot the mailinglist backup table to the real thing.
+ store.execute('DROP TABLE mailinglist;')
+ store.execute('ALTER TABLE ml_backup RENAME TO mailinglist;')
@@ -84,5 +92,14 @@ def upgrade_postgres(database, store, version, module_path):
WHERE id = {1};
""".format(_make_listid(mailing_list), id))
store.execute('ALTER TABLE ban DROP COLUMN mailing_list;')
+ store.execute('ALTER TABLE mailinglist DROP COLUMN new_member_options;')
+ store.execute('ALTER TABLE mailinglist DROP COLUMN send_reminders;')
+ store.execute('ALTER TABLE mailinglist DROP COLUMN subscribe_policy;')
+ store.execute('ALTER TABLE mailinglist DROP COLUMN unsubscribe_policy;')
+ store.execute(
+ 'ALTER TABLE mailinglist DROP COLUMN subscribe_auto_approval;')
+ store.execute('ALTER TABLE mailinglist DROP COLUMN private_roster;')
+ store.execute(
+ 'ALTER TABLE mailinglist DROP COLUMN admin_member_chunksize;')
# Record the migration in the version table.
database.load_schema(store, version, None, module_path)
diff --git a/src/mailman/database/schema/sqlite_20120407000000_01.sql b/src/mailman/database/schema/sqlite_20120407000000_01.sql
index 53bab70dd..5eacc4047 100644
--- a/src/mailman/database/schema/sqlite_20120407000000_01.sql
+++ b/src/mailman/database/schema/sqlite_20120407000000_01.sql
@@ -34,7 +34,7 @@
-- LP: #1024509
-CREATE TABLE ml_backup(
+CREATE TABLE ml_backup (
id INTEGER NOT NULL,
-- List identity
list_name TEXT,
diff --git a/src/mailman/database/schema/sqlite_20121015000000_01.sql b/src/mailman/database/schema/sqlite_20121015000000_01.sql
index c0df75111..3e2410c3b 100644
--- a/src/mailman/database/schema/sqlite_20121015000000_01.sql
+++ b/src/mailman/database/schema/sqlite_20121015000000_01.sql
@@ -20,3 +20,211 @@ INSERT INTO ban_backup SELECT
FROM ban;
ALTER TABLE ban_backup ADD COLUMN list_id TEXT;
+
+-- REMOVALS from the mailinglist table.
+-- REM new_member_options
+-- REM send_reminders
+-- REM subscribe_policy
+-- REM unsubscribe_policy
+-- REM subscribe_auto_approval
+-- REM private_roster
+-- REM admin_member_chunksize
+
+CREATE TABLE ml_backup (
+ id INTEGER NOT NULL,
+ list_name TEXT,
+ mail_host TEXT,
+ allow_list_posts BOOLEAN,
+ include_rfc2369_headers BOOLEAN,
+ created_at TIMESTAMP,
+ next_request_id INTEGER,
+ next_digest_number INTEGER,
+ digest_last_sent_at TIMESTAMP,
+ volume INTEGER,
+ last_post_at TIMESTAMP,
+ accept_these_nonmembers BLOB,
+ acceptable_aliases_id INTEGER,
+ admin_immed_notify BOOLEAN,
+ admin_notify_mchanges BOOLEAN,
+ administrivia BOOLEAN,
+ advertised BOOLEAN,
+ anonymous_list BOOLEAN,
+ autorespond_owner INTEGER,
+ autoresponse_owner_text TEXT,
+ autorespond_postings INTEGER,
+ autoresponse_postings_text TEXT,
+ autorespond_requests INTEGER,
+ autoresponse_request_text TEXT,
+ autoresponse_grace_period TEXT,
+ forward_unrecognized_bounces_to INTEGER,
+ process_bounces BOOLEAN,
+ bounce_info_stale_after TEXT,
+ bounce_matching_headers TEXT,
+ bounce_notify_owner_on_disable BOOLEAN,
+ bounce_notify_owner_on_removal BOOLEAN,
+ bounce_score_threshold INTEGER,
+ bounce_you_are_disabled_warnings INTEGER,
+ bounce_you_are_disabled_warnings_interval TEXT,
+ filter_action INTEGER,
+ filter_content BOOLEAN,
+ collapse_alternatives BOOLEAN,
+ convert_html_to_plaintext BOOLEAN,
+ default_member_action INTEGER,
+ default_nonmember_action INTEGER,
+ description TEXT,
+ digest_footer_uri TEXT,
+ digest_header_uri TEXT,
+ digest_is_default BOOLEAN,
+ digest_send_periodic BOOLEAN,
+ digest_size_threshold FLOAT,
+ digest_volume_frequency INTEGER,
+ digestable BOOLEAN,
+ discard_these_nonmembers BLOB,
+ emergency BOOLEAN,
+ encode_ascii_prefixes BOOLEAN,
+ first_strip_reply_to BOOLEAN,
+ footer_uri TEXT,
+ forward_auto_discards BOOLEAN,
+ gateway_to_mail BOOLEAN,
+ gateway_to_news BOOLEAN,
+ goodbye_message_uri TEXT,
+ header_matches BLOB,
+ header_uri TEXT,
+ hold_these_nonmembers BLOB,
+ info TEXT,
+ linked_newsgroup TEXT,
+ max_days_to_hold INTEGER,
+ max_message_size INTEGER,
+ max_num_recipients INTEGER,
+ member_moderation_notice TEXT,
+ mime_is_default_digest BOOLEAN,
+ moderator_password TEXT,
+ nondigestable BOOLEAN,
+ nonmember_rejection_notice TEXT,
+ obscure_addresses BOOLEAN,
+ owner_chain TEXT,
+ owner_pipeline TEXT,
+ personalize INTEGER,
+ post_id INTEGER,
+ posting_chain TEXT,
+ posting_pipeline TEXT,
+ preferred_language TEXT,
+ display_name TEXT,
+ reject_these_nonmembers BLOB,
+ reply_goes_to_list INTEGER,
+ reply_to_address TEXT,
+ require_explicit_destination BOOLEAN,
+ respond_to_post_requests BOOLEAN,
+ scrub_nondigest BOOLEAN,
+ send_goodbye_message BOOLEAN,
+ send_welcome_message BOOLEAN,
+ subject_prefix TEXT,
+ topics BLOB,
+ topics_bodylines_limit INTEGER,
+ topics_enabled BOOLEAN,
+ welcome_message_uri TEXT,
+ archive_policy INTEGER,
+ list_id TEXT,
+ nntp_prefix_subject_too INTEGER,
+ newsgroup_moderation INTEGER,
+ PRIMARY KEY (id)
+ );
+
+INSERT INTO ml_backup SELECT
+ id,
+ list_name,
+ mail_host,
+ allow_list_posts,
+ include_rfc2369_headers,
+ created_at,
+ next_request_id,
+ next_digest_number,
+ digest_last_sent_at,
+ volume,
+ last_post_at,
+ accept_these_nonmembers,
+ acceptable_aliases_id,
+ admin_immed_notify,
+ admin_notify_mchanges,
+ administrivia,
+ advertised,
+ anonymous_list,
+ autorespond_owner,
+ autoresponse_owner_text,
+ autorespond_postings,
+ autoresponse_postings_text,
+ autorespond_requests,
+ autoresponse_request_text,
+ autoresponse_grace_period,
+ forward_unrecognized_bounces_to,
+ process_bounces,
+ bounce_info_stale_after,
+ bounce_matching_headers,
+ bounce_notify_owner_on_disable,
+ bounce_notify_owner_on_removal,
+ bounce_score_threshold,
+ bounce_you_are_disabled_warnings,
+ bounce_you_are_disabled_warnings_interval,
+ filter_action,
+ filter_content,
+ collapse_alternatives,
+ convert_html_to_plaintext,
+ default_member_action,
+ default_nonmember_action,
+ description,
+ digest_footer_uri,
+ digest_header_uri,
+ digest_is_default,
+ digest_send_periodic,
+ digest_size_threshold,
+ digest_volume_frequency,
+ digestable,
+ discard_these_nonmembers,
+ emergency,
+ encode_ascii_prefixes,
+ first_strip_reply_to,
+ footer_uri,
+ forward_auto_discards,
+ gateway_to_mail,
+ gateway_to_news,
+ goodbye_message_uri,
+ header_matches,
+ header_uri,
+ hold_these_nonmembers,
+ info,
+ linked_newsgroup,
+ max_days_to_hold,
+ max_message_size,
+ max_num_recipients,
+ member_moderation_notice,
+ mime_is_default_digest,
+ moderator_password,
+ nondigestable,
+ nonmember_rejection_notice,
+ obscure_addresses,
+ owner_chain,
+ owner_pipeline,
+ personalize,
+ post_id,
+ posting_chain,
+ posting_pipeline,
+ preferred_language,
+ display_name,
+ reject_these_nonmembers,
+ reply_goes_to_list,
+ reply_to_address,
+ require_explicit_destination,
+ respond_to_post_requests,
+ scrub_nondigest,
+ send_goodbye_message,
+ send_welcome_message,
+ subject_prefix,
+ topics,
+ topics_bodylines_limit,
+ topics_enabled,
+ welcome_message_uri,
+ archive_policy,
+ list_id,
+ nntp_prefix_subject_too,
+ newsgroup_moderation
+ FROM mailinglist;
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index 4401b030f..4b784d8b3 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -24,6 +24,8 @@ __all__ = [
'TestMigration20120407MigratedData',
'TestMigration20120407Schema',
'TestMigration20120407UnchangedData',
+ 'TestMigration20121015MigratedData',
+ 'TestMigration20121015Schema',
]
@@ -151,8 +153,10 @@ class TestMigration20120407UnchangedData(MigrationTestBase):
'mailman.database.tests.data',
'migration_{0}_1.sql'.format(self._database.TAG))
self._database.load_sql(self._database.store, sample_data)
- # Update to the current migration we're testing.
- self._database.load_migrations('20120407000000')
+ # XXX 2012-12-28: We have to load the last migration defined in the
+ # system, otherwise the ORM model will not match the SQL table
+ # definitions and we'll get OperationalErrors from SQLite.
+ self._database.load_migrations('20121015000000')
def test_migration_domains(self):
# Test that the domains table, which isn't touched, doesn't change.
@@ -216,8 +220,10 @@ class TestMigration20120407MigratedData(MigrationTestBase):
self._database.load_sql(self._database.store, sample_data)
def _upgrade(self):
- # Update to the current migration we're testing.
- self._database.load_migrations('20120407000000')
+ # XXX 2012-12-28: We have to load the last migration defined in the
+ # system, otherwise the ORM model will not match the SQL table
+ # definitions and we'll get OperationalErrors from SQLite.
+ self._database.load_migrations('20121015000000')
def test_migration_archive_policy_never_0(self):
# Test that the new archive_policy value is updated correctly. In the
@@ -369,6 +375,14 @@ class TestMigration20121015Schema(MigrationTestBase):
['20121014999999'],
('list_id',),
('mailing_list',))
+ self._missing_present('mailinglist',
+ ['20121014999999'],
+ (),
+ ('new_member_options', 'send_reminders',
+ 'subscribe_policy', 'unsubscribe_policy',
+ 'subscribe_auto_approval', 'private_roster',
+ 'admin_member_chunksize'),
+ )
def test_post_upgrade_column_migrations(self):
self._missing_present('ban',
@@ -376,8 +390,17 @@ class TestMigration20121015Schema(MigrationTestBase):
'20121015000000'],
('mailing_list',),
('list_id',))
+ self._missing_present('mailinglist',
+ ['20121014999999',
+ '20121015000000'],
+ ('new_member_options', 'send_reminders',
+ 'subscribe_policy', 'unsubscribe_policy',
+ 'subscribe_auto_approval', 'private_roster',
+ 'admin_member_chunksize'),
+ ())
+
class TestMigration20121015MigratedData(MigrationTestBase):
"""Test non-migrated data."""