1
# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
1
# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
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
5
5
# as published by the Free Software Foundation; either version 2
6
6
# of the License, or (at your option) any later version.
8
8
# This program is distributed in the hope that it will be useful,
9
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
11
# GNU General Public License for more details.
13
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
"""Mixin class for MailList which handles administrative requests.
95
95
# fullname data field.
96
96
type, version = self.__db.get('version', (IGN, None))
97
97
if version is None:
98
# No previous revisiont number, must be upgrading to 2.1a3 or
98
# No previous revision number, must be upgrading to 2.1a3 or
99
99
# beyond from some unknown earlier version.
100
100
for id, (type, data) in self.__db.items():
103
elif id == HELDMSG and len(data) == 5:
103
elif type == HELDMSG and len(data) == 5:
104
104
# tack on a msgdata dictionary
105
105
self.__db[id] = data + ({},)
106
elif id == SUBSCRIPTION and len(data) == 5:
107
# a fullname field was added
108
stime, addr, password, digest, lang = data
109
self.__db[id] = stime, addr, '', password, digest, lang
106
elif type == SUBSCRIPTION:
108
# fullname and lang was added
109
stime, addr, password, digest = data
110
lang = self.preferred_language
111
data = stime, addr, '', password, digest, lang
113
# a fullname field was added
114
stime, addr, password, digest, lang = data
115
data = stime, addr, '', password, digest, lang
116
self.__db[id] = type, data
112
118
def __closedb(self):
113
119
if self.__db is not None:
130
136
os.rename(tmpfile, self.__filename())
132
138
def __request_id(self):
133
id = self.next_request_id
134
self.next_request_id += 1
139
id = self.next_request_id
140
self.next_request_id += 1
137
143
def SaveRequestsDb(self):
374
380
# and inform of this status.
378
384
def HoldSubscription(self, addr, fullname, password, digest, lang):
379
385
# Assure that the database is open for writing
390
396
# the subscriber's address
391
397
# the subscriber's selected password (TBD: is this safe???)
392
398
# the digest flag
393
# the user's preferred language
399
# the user's preferred language
395
401
data = time.time(), addr, fullname, password, digest, lang
396
402
self.__db[id] = (SUBSCRIPTION, data)
493
499
# to his/her language choice, if they are a member. Otherwise use the
494
500
# list's preferred language.
495
501
realname = self.real_name
497
503
lang = self.getMemberLanguage(recip)
498
504
text = Utils.maketext(