1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
# Copyright (C) 1998 by the Free Software Foundation, Inc.
#
# This program 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 2
# of the License, or (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
"""Shared mailman errors and messages."""
# XXX: These should be converted to new style class exceptions
MMUnknownListError = "MMUnknownListError"
MMBadListError = "MMBadListError"
MMBadUserError = "MMBadUserError"
MMBadConfigError = "MMBadConfigError"
# Exception hierarchy for various authentication failures, can be
# raised from functions in SecurityManager.py
class MMAuthenticationError(Exception): pass
class MMBadPasswordError(MMAuthenticationError): pass
class MMPasswordsMustMatch(MMAuthenticationError): pass
class MMCookieError(MMAuthenticationError): pass
class MMExpiredCookieError(MMCookieError): pass
class MMInvalidCookieError(MMCookieError): pass
MMMustDigestError = "MMMustDigestError"
MMCantDigestError = "MMCantDigestError"
MMNotAMemberError = "MMNotAMemberError"
MMListNotReady = "MMListNotReady"
MMNoSuchUserError = "MMNoSuchUserError"
MMNeedApproval = "MMNeedApproval"
MMSubscribeNeedsConfirmation = "MMSubscribeNeedsConfirmation"
MMBadConfirmation = "MMBadConfirmation"
MMAlreadyAMember = "MMAlreadyAMember"
MMAlreadyDigested = "MMAlreadyDigested"
MMAlreadyUndigested = "MMAlreadyUndigested"
MODERATED_LIST_MSG = "Moderated list"
IMPLICIT_DEST_MSG = "Implicit destination"
SUSPICIOUS_HEADER_MSG = "Suspicious header"
FORBIDDEN_SENDER_MSG = "Forbidden sender"
# XXX: This should be converted to templates/*.txt style
MESSAGE_DECORATION_NOTE = """This text can include <b>%(field)s</b> format
strings which are resolved against the list's attribute dictionary (__dict__).
Some useful fields are:
<dl>
<dt>real_name
<dd>The "pretty" name of the list, with capitalization.
<dt>_internal_name
<dd>The name by which the list is identified in URLs, where case
is germane.
<dt>host_name
<dd>The domain-qualified host name where the list server runs.
<dt>web_page_url
<dd>The mailman root URL to which, eg, 'listinfo/%(_internal_name)s
can be appended to yield the listinfo page for the list.
<dt>description
<dd>The brief description of the list.
<dt>info
<dd>The less brief list description.
</dl>
"""
# New style class based exceptions. All the above errors should eventually be
# converted.
class MailmanError(Exception):
"""Base class for all Mailman exceptions."""
pass
class MMLoopingPost(MailmanError):
"""Post already went through this list!"""
pass
# Exception hierarchy for bad email address errors that can be raised from
# Utils.ValidateEmail()
class EmailAddressError(MailmanError):
"""Base class for email address validation errors."""
pass
class MMBadEmailError(EmailAddressError):
"""Email address is invalid (empty string or not fully qualified)."""
pass
class MMHostileAddress(EmailAddressError):
"""Email address has potentially hostile characters in it."""
pass
# Exceptions for admin request database
class LostHeldMessage(MailmanError):
"""Held message was lost."""
pass
|