summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Warsaw2012-12-29 23:31:50 -0500
committerBarry Warsaw2012-12-29 23:31:50 -0500
commit232dda432a0033f1857dbe4f1957ad29c498ba53 (patch)
treec484f54ee6a01b4c447462d024cedc5357a77e66
parent582d6e486f9693a2ce082071b747eec468df19b6 (diff)
downloadmailman-232dda432a0033f1857dbe4f1957ad29c498ba53.tar.gz
mailman-232dda432a0033f1857dbe4f1957ad29c498ba53.tar.zst
mailman-232dda432a0033f1857dbe4f1957ad29c498ba53.zip
-rw-r--r--src/mailman/database/schema/mm_20121015000000.py1
-rw-r--r--src/mailman/database/schema/sqlite_20121015000000_01.sql1
-rw-r--r--src/mailman/database/tests/test_migrations.py10
-rw-r--r--src/mailman/docs/NEWS.rst5
-rw-r--r--src/mailman/interfaces/mailinglist.py3
-rw-r--r--src/mailman/model/mailinglist.py7
-rw-r--r--src/mailman/styles/default.py1
-rw-r--r--src/mailman/styles/docs/styles.rst26
8 files changed, 18 insertions, 36 deletions
diff --git a/src/mailman/database/schema/mm_20121015000000.py b/src/mailman/database/schema/mm_20121015000000.py
index bfbf5cb62..7ccf93289 100644
--- a/src/mailman/database/schema/mm_20121015000000.py
+++ b/src/mailman/database/schema/mm_20121015000000.py
@@ -87,6 +87,5 @@ 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 ADD COLUMN style_name;')
# Record the migration in the version table.
database.load_schema(store, version, None, module_path)
diff --git a/src/mailman/database/schema/sqlite_20121015000000_01.sql b/src/mailman/database/schema/sqlite_20121015000000_01.sql
index e9e3661e0..c0df75111 100644
--- a/src/mailman/database/schema/sqlite_20121015000000_01.sql
+++ b/src/mailman/database/schema/sqlite_20121015000000_01.sql
@@ -20,4 +20,3 @@ INSERT INTO ban_backup SELECT
FROM ban;
ALTER TABLE ban_backup ADD COLUMN list_id TEXT;
-ALTER TABLE mailinglist ADD COLUMN style_name TEXT;
diff --git a/src/mailman/database/tests/test_migrations.py b/src/mailman/database/tests/test_migrations.py
index e813d4341..6d27f01f0 100644
--- a/src/mailman/database/tests/test_migrations.py
+++ b/src/mailman/database/tests/test_migrations.py
@@ -375,10 +375,6 @@ class TestMigration20121015Schema(MigrationTestBase):
['20121014999999'],
('list_id',),
('mailing_list',))
- self._missing_present('mailinglist',
- ['20121014999999'],
- ('style_name',),
- ())
def test_post_upgrade_column_migrations(self):
self._missing_present('ban',
@@ -386,13 +382,9 @@ class TestMigration20121015Schema(MigrationTestBase):
'20121015000000'],
('mailing_list',),
('list_id',))
- self._missing_present('mailinglist',
- ['20121014999999',
- '20121015000000'],
- (),
- ('style_name',))
+
class TestMigration20121015MigratedData(MigrationTestBase):
"""Test non-migrated data."""
diff --git a/src/mailman/docs/NEWS.rst b/src/mailman/docs/NEWS.rst
index aad8f37ff..a9a238f3c 100644
--- a/src/mailman/docs/NEWS.rst
+++ b/src/mailman/docs/NEWS.rst
@@ -14,7 +14,7 @@ Here is a history of user visible changes to Mailman.
Compatibility
-------------
- * Python 2.7 is not required. Python 2.6 is no longer officially supported.
+ * Python 2.7 is now required. Python 2.6 is no longer officially supported.
The code base is now also `python2.7 -3` clean, although there are still
some warnings in 3rd party dependencies. (LP: #1073506)
@@ -33,6 +33,9 @@ REST
- `_mod_sender` -> `sender`
- `_mod_message_id` -> `message_id`
+ * 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: #675692)
* Allow the getting/setting of IMailingList.subject_prefix via the REST API
(given by Terri Oda). (LP: #1062893)
* Expose a REST API for membership change (subscriptions and unsubscriptions)
diff --git a/src/mailman/interfaces/mailinglist.py b/src/mailman/interfaces/mailinglist.py
index 798680782..8a4436a21 100644
--- a/src/mailman/interfaces/mailinglist.py
+++ b/src/mailman/interfaces/mailinglist.py
@@ -132,9 +132,6 @@ class IMailingList(Interface):
"""Advertise this mailing list when people ask for an overview of the
available mailing lists.""")
- style_name = Attribute(
- """The name of the last style applied, or None.""")
-
# Contact addresses
posting_address = Attribute(
diff --git a/src/mailman/model/mailinglist.py b/src/mailman/model/mailinglist.py
index a78745936..96cb22f59 100644
--- a/src/mailman/model/mailinglist.py
+++ b/src/mailman/model/mailinglist.py
@@ -87,7 +87,6 @@ class MailingList(Model):
include_rfc2369_headers = Bool()
advertised = Bool()
anonymous_list = Bool()
- style_name = Unicode()
# Attributes not directly modifiable via the web u/i
created_at = DateTime()
admin_member_chunksize = Int()
@@ -211,9 +210,9 @@ class MailingList(Model):
# that's not the case when the constructor is called. So, set up the
# rosters explicitly.
self.__storm_loaded__()
- self.personalize = Personalization.none
- self.display_name = string.capwords(
- SPACE.join(listname.split(UNDERSCORE)))
+ ## self.personalize = Personalization.none
+ ## self.display_name = string.capwords(
+ ## SPACE.join(listname.split(UNDERSCORE)))
makedirs(self.data_path)
def __storm_loaded__(self):
diff --git a/src/mailman/styles/default.py b/src/mailman/styles/default.py
index 138d49872..af0151c71 100644
--- a/src/mailman/styles/default.py
+++ b/src/mailman/styles/default.py
@@ -54,7 +54,6 @@ class DefaultStyle:
mlist = mailing_list
# List identity.
mlist.display_name = mlist.list_name.capitalize()
- mlist.style_name = self.name
mlist.include_rfc2369_headers = True
mlist.allow_list_posts = True
# Most of these were ripped from the old MailList.InitVars() method.
diff --git a/src/mailman/styles/docs/styles.rst b/src/mailman/styles/docs/styles.rst
index ccacbdb88..e4c8f754f 100644
--- a/src/mailman/styles/docs/styles.rst
+++ b/src/mailman/styles/docs/styles.rst
@@ -26,14 +26,14 @@ style is applied.
>>> from mailman.interfaces.listmanager import IListManager
>>> mlist = getUtility(IListManager).create('ant@example.com')
- >>> print mlist.style_name
+ >>> print mlist.display_name
None
-By applying a style, the style name gets assigned.
+The default style sets the list's display name.
>>> manager.get('default').apply(mlist)
- >>> print mlist.list_id, mlist.style_name
- ant.example.com default
+ >>> print mlist.display_name
+ Ant
Registering styles
@@ -48,8 +48,7 @@ New styles must implement the ``IStyle`` interface.
... name = 'a-test-style'
... def apply(self, mailing_list):
... # Just does something very simple.
- ... mailing_list.style_name = self.name
- ... mailing_list.style_thing = 'thing 1'
+ ... mailing_list.display_name = 'TEST STYLE LIST'
You can register a new style with the style manager.
@@ -99,13 +98,11 @@ Now, when we use the high level API, we can ask for the style to be applied.
>>> from mailman.app.lifecycle import create_list
>>> mlist = create_list('bee@example.com', style_name=test_style.name)
- >>> print mlist.list_id, mlist.style_name
- bee.example.com a-test-style
The style has been applied.
- >>> print mlist.style_thing
- thing 1
+ >>> print mlist.display_name
+ TEST STYLE LIST
If no style name is provided when creating the list, the system default style
(which may or may not be the style named 'default') is applied.
@@ -115,8 +112,7 @@ If no style name is provided when creating the list, the system default style
... name = 'another-style'
... def apply(self, mailing_list):
... # Just does something very simple.
- ... mailing_list.style_name = self.name
- ... mailing_list.style_thing = 'thing 2'
+ ... mailing_list.display_name = 'ANOTHER STYLE LIST'
>>> another_style = AnotherStyle()
We'll set up the system default to apply this newly registered style if no
@@ -126,7 +122,5 @@ other style is explicitly given.
>>> with configuration('styles', default=another_style.name):
... manager.register(another_style)
... mlist = create_list('cat@example.com')
- >>> print mlist.style_name
- another-style
- >>> print mlist.style_thing
- thing 2
+ >>> print mlist.display_name
+ ANOTHER STYLE LIST