~launchpad-pqm/mailman/2.1

« back to all changes in this revision

Viewing changes to Mailman/Gui/GUIBase.py

  • Committer: Launchpad Patch Queue Manager
  • Date: 2009-10-21 01:06:17 UTC
  • mfrom: (975.1.1 mailman.2112)
  • Revision ID: launchpad@pqm.canonical.com-20091021010617-prbs2ay6nhxx515v
[rs=flacoste] Upgrade Mailman to upstream 2.1.12

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2002-2004 by the Free Software Foundation, Inc.
 
1
# Copyright (C) 2002-2008 by the Free Software Foundation, Inc.
2
2
#
3
3
# This program is free software; you can redistribute it and/or
4
4
# modify it under the terms of the GNU General Public License
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
16
# USA.
16
17
 
17
18
"""Base class for all web GUI components."""
18
19
 
77
78
                            re.compile(addr)
78
79
                        except re.error:
79
80
                            raise ValueError
 
81
                    elif (wtype == mm_cfg.EmailListEx and addr.startswith('@')
 
82
                            and property.endswith('_these_nonmembers')):
 
83
                        # XXX Needs to be reviewed for list@domain names.
 
84
                        # don't reference your own list
 
85
                        if addr[1:] == mlist.internal_name():
 
86
                            raise ValueError
 
87
                        # check for existence of list?  For now allow
 
88
                        # reference to list before creating it.
80
89
                    else:
81
90
                        raise
 
91
                if property in ('regular_exclude_lists',
 
92
                                'regular_include_lists'):
 
93
                    if addr.lower() == mlist.GetListEmail().lower():
 
94
                        raise Errors.EmailAddressError
82
95
                addrs.append(addr)
83
96
            return addrs
84
97
        # This is a host name, i.e. verbatim
86
99
            return val
87
100
        # This is a number, either a float or an integer
88
101
        if wtype == mm_cfg.Number:
 
102
            # The int/float code below doesn't work if we are called from
 
103
            # config_list with a value that is already a float.  It will
 
104
            # truncate the value to an int.
 
105
            if isinstance(val, float):
 
106
                return val
89
107
            num = -1
90
108
            try:
91
109
                num = int(val)
122
140
        # Validate all the attributes for this category
123
141
        pass
124
142
 
125
 
    def _escape(self, property, value):
126
 
        value = value.replace('<', '&lt;')
127
 
        return value
128
 
 
129
143
    def handleForm(self, mlist, category, subcat, cgidata, doc):
130
144
        for item in self.GetConfigInfo(mlist, category, subcat):
131
145
            # Skip descriptions and legacy non-attributes
144
158
            elif not cgidata.has_key(property):
145
159
                continue
146
160
            elif isinstance(cgidata[property], ListType):
147
 
                val = [self._escape(property, x.value)
148
 
                       for x in cgidata[property]]
 
161
                val = [x.value for x in cgidata[property]]
149
162
            else:
150
 
                val = self._escape(property, cgidata[property].value)
 
163
                val = cgidata[property].value
151
164
            # Coerce the value to the expected type, raising exceptions if the
152
165
            # value is invalid.
153
166
            try: