summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mailman/rest/helpers.py4
-rw-r--r--src/mailman/rules/administrivia.py2
-rw-r--r--src/mailman/rules/moderation.py4
-rw-r--r--src/mailman/runners/command.py6
4 files changed, 8 insertions, 8 deletions
diff --git a/src/mailman/rest/helpers.py b/src/mailman/rest/helpers.py
index 2ce62b0fe..2824a894e 100644
--- a/src/mailman/rest/helpers.py
+++ b/src/mailman/rest/helpers.py
@@ -77,10 +77,10 @@ class ExtendedEncoder(json.JSONEncoder):
seconds = obj.seconds + obj.microseconds / 1000000.0
return '{0}d{1}s'.format(obj.days, seconds)
return '{0}d'.format(obj.days)
- elif hasattr(obj, 'enumclass') and issubclass(obj.enumclass, Enum):
+ elif hasattr(obj, 'enum') and issubclass(obj.enum, Enum):
# It's up to the decoding validator to associate this name with
# the right Enum class.
- return obj.enumname
+ return obj.name
return json.JSONEncoder.default(self, obj)
diff --git a/src/mailman/rules/administrivia.py b/src/mailman/rules/administrivia.py
index 790c16c19..41c6edf30 100644
--- a/src/mailman/rules/administrivia.py
+++ b/src/mailman/rules/administrivia.py
@@ -81,7 +81,7 @@ class Administrivia:
lineno = 0
for line in lines:
line = line.strip()
- if line == '':
+ if len(line) == 0:
continue
lineno += 1
if lineno > config.mailman.email_commands_max_lines:
diff --git a/src/mailman/rules/moderation.py b/src/mailman/rules/moderation.py
index bcec47cba..cb27d89d8 100644
--- a/src/mailman/rules/moderation.py
+++ b/src/mailman/rules/moderation.py
@@ -57,7 +57,7 @@ class MemberModeration:
elif action is not None:
# We must stringify the moderation action so that it can be
# stored in the pending request table.
- msgdata['moderation_action'] = action.enumname
+ msgdata['moderation_action'] = action.name
msgdata['moderation_sender'] = sender
return True
# The sender is not a member so this rule does not match.
@@ -98,7 +98,7 @@ class NonmemberModeration:
elif action is not None:
# We must stringify the moderation action so that it can be
# stored in the pending request table.
- msgdata['moderation_action'] = action.enumname
+ msgdata['moderation_action'] = action.name
msgdata['moderation_sender'] = sender
return True
# The sender must be a member, so this rule does not match.
diff --git a/src/mailman/runners/command.py b/src/mailman/runners/command.py
index f13b02229..ac611ed3a 100644
--- a/src/mailman/runners/command.py
+++ b/src/mailman/runners/command.py
@@ -85,7 +85,7 @@ class CommandFinder:
# bogus characters. Otherwise, there's nothing in the subject
# that we can use.
if isinstance(raw_subject, unicode):
- safe_subject = raw_subject.encode('us-ascii', errors='ignore')
+ safe_subject = raw_subject.encode('us-ascii', 'ignore')
self.command_lines.append(safe_subject)
# Find the first text/plain part of the message.
part = None
@@ -119,7 +119,7 @@ class CommandFinder:
# ASCII commands and arguments, ignore anything else.
parts = [(part
if isinstance(part, unicode)
- else part.decode('ascii', errors='ignore'))
+ else part.decode('ascii', 'ignore'))
for part in parts]
yield parts
@@ -139,7 +139,7 @@ The results of your email command are provided below.
def write(self, text):
if not isinstance(text, unicode):
- text = text.decode(self.charset, errors='ignore')
+ text = text.decode(self.charset, 'ignore')
self._output.write(text)
def __unicode__(self):