summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/model/preferences.py2
-rw-r--r--src/mailman/model/tests/test_preferences.py10
-rw-r--r--src/mailman/model/tests/test_user.py12
-rw-r--r--src/mailman/model/user.py8
-rw-r--r--src/mailman/rest/tests/test_addresses.py2
5 files changed, 18 insertions, 16 deletions
diff --git a/src/mailman/model/preferences.py b/src/mailman/model/preferences.py
index b69282e37..b76499020 100644
--- a/src/mailman/model/preferences.py
+++ b/src/mailman/model/preferences.py
@@ -73,5 +73,5 @@ class Preferences(Model):
if not c.primary_key]
for cname in column_names:
if (getattr(self, cname) is None and
- getattr(preferences, cname) is not None):
+ getattr(preferences, cname) is not None):
setattr(self, cname, getattr(preferences, cname))
diff --git a/src/mailman/model/tests/test_preferences.py b/src/mailman/model/tests/test_preferences.py
index 929833595..ea7cdc62c 100644
--- a/src/mailman/model/tests/test_preferences.py
+++ b/src/mailman/model/tests/test_preferences.py
@@ -17,23 +17,19 @@
"""Test preferences."""
-__all__ = [
- 'TestPreferences',
- ]
-
-
import unittest
from mailman.app.lifecycle import create_list
-from mailman.config import config
from mailman.database.transaction import transaction
from mailman.interfaces.languages import ILanguageManager
from mailman.interfaces.member import DeliveryMode, DeliveryStatus
from mailman.interfaces.usermanager import IUserManager
-from mailman.model.preferences import Preferences
from mailman.testing.layers import ConfigLayer
from zope.component import getUtility
+__all__ = [
+ 'TestPreferences',
+ ]
class TestPreferences(unittest.TestCase):
diff --git a/src/mailman/model/tests/test_user.py b/src/mailman/model/tests/test_user.py
index 8c509c60a..5bb684331 100644
--- a/src/mailman/model/tests/test_user.py
+++ b/src/mailman/model/tests/test_user.py
@@ -134,9 +134,11 @@ class TestUser(unittest.TestCase):
bill_addr_2 = self._manager.create_address('bill2@example.com')
bill.link(bill_addr_2)
self._anne.absorb(bill)
- self.assertIn('bill@example.com',
+ self.assertIn(
+ 'bill@example.com',
list(a.email for a in self._anne.addresses))
- self.assertIn('bill2@example.com',
+ self.assertIn(
+ 'bill2@example.com',
list(a.email for a in self._anne.addresses))
# The preferred address shouldn't change.
self.assertEqual(self._anne.preferred_address, anne_addr)
@@ -178,7 +180,11 @@ class TestUser(unittest.TestCase):
memberships[member.list_id] = member
self.assertEqual(
set(memberships.keys()),
- set(['test.example.com', 'test2.example.com', 'test3.example.com']))
+ set([
+ 'test.example.com',
+ 'test2.example.com',
+ 'test3.example.com',
+ ]))
# The subscription to test@example.com already existed, it must not be
# overwritten.
self.assertEqual(
diff --git a/src/mailman/model/user.py b/src/mailman/model/user.py
index fe4f1c6d4..a7d3f2353 100644
--- a/src/mailman/model/user.py
+++ b/src/mailman/model/user.py
@@ -31,8 +31,8 @@ from mailman.model.preferences import Preferences
from mailman.model.roster import Memberships
from mailman.utilities.datetime import factory as date_factory
from mailman.utilities.uid import UIDFactory
-from sqlalchemy import not_
-from sqlalchemy import Boolean, Column, DateTime, ForeignKey, Integer, Unicode
+from sqlalchemy import (
+ Boolean, Column, DateTime, ForeignKey, Integer, Unicode)
from sqlalchemy.orm import backref, relationship
from zope.event import notify
from zope.interface import implementer
@@ -181,7 +181,7 @@ class User(Model):
"""See `IUser`."""
assert user is not None
if user.id == self.id:
- return # Protect against absorbing oneself.
+ return # Protect against absorbing oneself.
# Relink addresses.
for address in list(user.addresses):
# convert to list because we'll mutate the result
@@ -189,7 +189,7 @@ class User(Model):
# Merge memberships.
other_members = store.query(Member).filter(
Member.user_id == user.id)
- subscribed_lists = [ m.list_id for m in self.memberships.members ]
+ subscribed_lists = [m.list_id for m in self.memberships.members]
for member in other_members:
# Only import memberships of lists I'm not subscribed to yet,
# delete the rest.
diff --git a/src/mailman/rest/tests/test_addresses.py b/src/mailman/rest/tests/test_addresses.py
index c75641ea9..85bd117ef 100644
--- a/src/mailman/rest/tests/test_addresses.py
+++ b/src/mailman/rest/tests/test_addresses.py
@@ -218,7 +218,7 @@ class TestAddresses(unittest.TestCase):
user_manager = getUtility(IUserManager)
with transaction():
anne = user_manager.create_user('anne@example.com')
- bill = user_manager.create_user('bill@example.com')
+ user_manager.create_user('bill@example.com')
response, content = call_api(
'http://localhost:9001/3.0/users/anne@example.com/addresses', {
'email': 'bill@example.com',