rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
aside_new(fname, fname_last) aside_new(fname_tmp, fname)
try: os.unlink(fname_last) except os.error, (code, msg): if code <> errno.ENOENT: Utils.reraise() os.link(fname, fname_last) os.rename(fname_tmp, fname)
def Save(self):
def aside_new(old_name, new_name, reopen=0): """Utility to move aside a file, optionally returning a fresh open version. We ensure maintanance of proper umask in the process.""" ou = os.umask(007) try: if os.path.exists(new_name): os.unlink(new_name) if os.path.exists(old_name): os.link(old_name, new_name) os.unlink...
def __repr__(self):
d = SafeDict({'listname': self.real_name})
d = SafeDict({'listname': self.internal_name()})
def ExternalArchive(self, ar, txt): d = SafeDict({'listname': self.real_name}) cmd = ar % d extarch = os.popen(cmd, 'w') extarch.write(txt) extarch.close()
extarch.close()
status = extarch.close() if status: self.LogMsg('error', 'external archiver non-zero exit status: %d\n' % (status & 0xff00) >> 8)
def ExternalArchive(self, ar, txt): d = SafeDict({'listname': self.real_name}) cmd = ar % d extarch = os.popen(cmd, 'w') extarch.write(txt) extarch.close()
def uheader(mlist, s, header_name=None):
def uheader(mlist, s, header_name=None, continuation_ws='\t'):
def uheader(mlist, s, header_name=None): # Get the charset to encode the string in. If this is us-ascii, we'll use # iso-8859-1 instead, just to get a little extra coverage, and because the # Header class tries us-ascii first anyway. charset = Utils.GetCharSet(mlist.preferred_language) if charset == 'us-ascii': charse...
return Header(s, charset, header_name=header_name)
return Header(s, charset, header_name=header_name, continuation_ws=continuation_ws)
def uheader(mlist, s, header_name=None): # Get the charset to encode the string in. If this is us-ascii, we'll use # iso-8859-1 instead, just to get a little extra coverage, and because the # Header class tries us-ascii first anyway. charset = Utils.GetCharSet(mlist.preferred_language) if charset == 'us-ascii': charse...
try:
if hasattr(gui, 'GetConfigCategory') and \ hasattr(gui, 'GetConfigInfo'):
def GetConfigInfo(self): info = {} for gui in self._gui: try: key = gui.GetConfigCategory()[0] value = gui.GetConfigInfo(self) except AttributeError: pass else: info[key] = value return info
except AttributeError: pass else:
def GetConfigInfo(self): info = {} for gui in self._gui: try: key = gui.GetConfigCategory()[0] value = gui.GetConfigInfo(self) except AttributeError: pass else: info[key] = value return info
" message. <p>" + Errors.MESSAGE_DECORATION_NOTE),
" message. " + Utils.maketext('headfoot.html', raw=1)),
def GetConfigInfo(self):
fullname = Utils.canonstr(fullname)
fullname = Utils.canonstr(fullname, lang)
def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0)
return _translation.gettext(s) % dict
tns = _translation.gettext(s) charset = _translation.charset() if not charset: charset = 'us-ascii' for k, v in dict.items(): if isinstance(v, UnicodeType): dict[k] = v.encode(charset, 'replace') return tns % dict
def _(s): if s == '': return s assert s # Do translation of the given string into the current language, and do # Ping-string interpolation into the resulting string. # # This lets you write something like: # # now = time.ctime(time.time()) # print _('The current time is: %(now)s') # # and have it Just Work. No...
self.fp.write('\n') self.fp.write(msg.body)
self.fp.write('\n') for line in string.split(msg.body, '\n'): if line[:5] == 'From ' and self._isrealfromline(line): self.fp.write('>') self.fp.write(line + '\n')
def AppendMessage(self, msg):
article=self.database.getArticle(self.archive, msgid) if article.parentID==None or not self.database.hasArticle(self.archive, article.parentID): key=article.date else: parent=self.database.getArticle(self.archive, article.parentID) article.threadKey=parent.threadKey+article.date+'-' self.database.setThreadKey(self.arch...
try: article=self.database.getArticle(self.archive, msgid) except KeyError: pass else: if article.parentID==None or \ not self.database.hasArticle(self.archive, article.parentID): key=article.date else: parent=self.database.getArticle(self.archive, article.parentID) article.threadKey=parent.threadKey+article.date+'-' ...
def updateThreadedIndex(self):
article=self.database.getArticle(self.archive, msgid) count=count+1 self.write_index_entry(article) msgid = self.database.next(archive, i )
try: article=self.database.getArticle(self.archive, msgid) except KeyError: pass else: count=count+1 self.write_index_entry(article) msgid = self.database.next(archive, i)
def update_archive(self, archive):
_zapfile(TEXTFILE) _zapfile(VTEXTFILE)
_zapfile(ALIASFILE) _zapfile(VIRTFILE)
def clear(): _zapfile(TEXTFILE) _zapfile(VTEXTFILE)
len(self.__dict__.keys()) > 0
return len(self.__dict__.keys()) > 0
def __nonzero__(self): len(self.__dict__.keys()) > 0
self.__noresponse = 0
def __init__(self): self.__errors = 0 self.__respbuf = '' self.__dispatch = { 'subscribe' : self.ProcessSubscribeCmd, 'join' : self.ProcessSubscribeCmd, 'confirm' : self.ProcessConfirmCmd, 'unsubscribe' : self.ProcessUnsubscribeCmd, 'remove' : self.ProcessUnsubscribeCmd, 'leave' : self.ProcessUn...
assert not self.__db.has_key(id)
while self.__db.has_key(id): id = self.__request_id()
def HoldMessage(self, msg, reason, msgdata={}): # Make a copy of msgdata so that subsequent changes won't corrupt the # request database. TBD: remove the `filebase' key since this will # not be relevant when the message is resurrected. newmsgdata = {} newmsgdata.update(msgdata) msgdata = newmsgdata # assure that the d...
digest = 0
digest = mlist.digest_is_default
def safeint(formvar, defaultval=None): try: return int(cgidata.getvalue(formvar)) except (ValueError, TypeError): return defaultval
print name, '=', mm_cfg.__dict__[name]
value = mm_cfg.__dict__[name] if isinstance(value, str): if re.search('\n', value): print '%s = """%s"""' %(name, value) else: print "%s = '%s'" % (name, value) else: print '%s = ' % name, pp.pprint(value)
def main(): parser, opts, args = parseargs() patterns = [] if opts.ignorecase: flag = re.IGNORECASE else: flag = 0 for pattern in args: patterns.append(re.compile(pattern, flag)) names = mm_cfg.__dict__.keys() names.sort() for name in names: if not opts.verbose: if name.startswith('_') or re.search('[a-z]', name): co...
def html_quote(s):
def html_quote(s, lang=None):
def html_quote(s): repls = ( ('&', '&amp;'), ("<", '&lt;'), (">", '&gt;'), ('"', '&quot;')) for thing, repl in repls: s = s.replace(thing, repl) return Utils.uquote(s)
return Utils.uquote(s)
return Utils.uncanonstr(s, lang)
def html_quote(s): repls = ( ('&', '&amp;'), ("<", '&lt;'), (">", '&gt;'), ('"', '&quot;')) for thing, repl in repls: s = s.replace(thing, repl) return Utils.uquote(s)
def CGIescape(arg):
def CGIescape(arg, lang=None):
def CGIescape(arg): if isinstance(arg, types.UnicodeType): s = Utils.websafe(arg) else: s = Utils.websafe(str(arg)) return Utils.uquote(s.replace('"', '&quot;'))
return Utils.uquote(s.replace('"', '&quot;'))
return Utils.uncanonstr(s.replace('"', '&quot;'), lang)
def CGIescape(arg): if isinstance(arg, types.UnicodeType): s = Utils.websafe(arg) else: s = Utils.websafe(str(arg)) return Utils.uquote(s.replace('"', '&quot;'))
return html_quote(buf)
return html_quote(buf, self._lang)
def quote(self, buf): return html_quote(buf)
if self.charset is None and a_charset:
if self.charset is None and s_charset:
def check_header_charsets(self, msg_charset=None): """Check From and Subject for encoded-words
if c <> self.charset:
if c and c <> 'us-ascii' and c <> self.charset:
def decode_charset(self, field): if field.find("=?") == -1: return None, None # Get the decoded header as a list of (s, charset) tuples pairs = decode_header(field) mustunicode = 0 for s, c in pairs: # If the charset of all the header parts match the article's # charset, leave it as encoded, otherwise try converting to...
('subject', 'subject_html')):
('subject', 'subject_html'), ('subject', 'title')):
def _add_decoded(self, d): """Add encoded-word keys to HTML output""" for src, dst in (('author', 'author_html'), ('email', 'email_html'), ('subject', 'subject_html')): if self.decoded.has_key(src): d[dst] = self.quote(self.decoded[src])
try: d = {"lastdate": html_quote(i18n.ctime(self.lastdate)), "archivedate": html_quote(i18n.ctime(self.archivedate)),
def quotetime(s): return html_quote(i18n.ctime(s), self.lang) try: d = {"lastdate": quotetime(self.lastdate), "archivedate": quotetime(self.archivedate),
def html_foot(self): # avoid i18n side-effects mlist = self.maillist otrans = i18n.get_translation() i18n.set_language(mlist.preferred_language) try: d = {"lastdate": html_quote(i18n.ctime(self.lastdate)), "archivedate": html_quote(i18n.ctime(self.archivedate)), "listinfo": mlist.GetScriptURL('listinfo', absolute=1), "...
try: d = {"listname": html_quote(mlist.real_name),
def quotetime(s): return html_quote(i18n.ctime(s), self.lang) try: d = {"listname": html_quote(mlist.real_name, self.lang),
def html_head(self): # avoid i18n side-effects mlist = self.maillist otrans = i18n.get_translation() i18n.set_language(mlist.preferred_language) try: d = {"listname": html_quote(mlist.real_name), "archtype": self.type, "archive": self.volNameToDesc(self.archive), "listinfo": mlist.GetScriptURL('listinfo', absolute=1),...
"firstdate": html_quote(i18n.ctime(self.firstdate)), "lastdate": html_quote(i18n.ctime(self.lastdate)),
"firstdate": quotetime(self.firstdate), "lastdate": quotetime(self.lastdate),
def html_head(self): # avoid i18n side-effects mlist = self.maillist otrans = i18n.get_translation() i18n.set_language(mlist.preferred_language) try: d = {"listname": html_quote(mlist.real_name), "archtype": self.type, "archive": self.volNameToDesc(self.archive), "listinfo": mlist.GetScriptURL('listinfo', absolute=1),...
subject = CGIescape(subject) author = CGIescape(author)
subject = CGIescape(subject, self.lang) author = CGIescape(author, self.lang)
def write_index_entry(self, article): subject = self.get_header("subject", article) author = self.get_header("author", article) if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: author = re.sub('@', _(' at '), author) subject = CGIescape(subject) author = CGIescape(author)
Lorig=L=source[i] ; prefix=suffix="" if L==None: continue
Lorig = L = source[i] prefix = suffix = "" if L is None: continue
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
quoted=quotedpat.match(L) if quoted==None: last_line_was_quoted=0
quoted = quotedpat.match(L) if quoted is None: last_line_was_quoted = 0
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
prefix=CGIescape(L[:quoted]) + '<i>' suffix='</I>'
prefix = CGIescape(L[:quoted], self.lang) + '<i>' suffix = '</I>'
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
suffix=suffix+'<BR>'
suffix += '<BR>'
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
while jr != None or kr != None:
while jr is not None or kr is not None:
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
if kr == None:
if kr is None:
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
L2 = L2 + ('%s<A HREF="%s">%s</A>' % (CGIescape(L[:pos]), URL, CGIescape(text))) L=L[pos+length:] jr=emailpat.search(L) ; kr=urlpat.search(L) if jr==None and kr==None: L=CGIescape(L) L=prefix+L2+L+suffix if L!=Lorig: source[i], dest[i]=None, L
L2 += '%s<A HREF="%s">%s</A>' % ( CGIescape(L[:pos], self.lang), URL, CGIescape(text, self.lang)) L = L[pos+length:] jr = emailpat.search(L) kr = urlpat.search(L) if jr is None and kr is None: L = CGIescape(L, self.lang) L = prefix + L2 + L + suffix if L != Lorig: source[i] = None dest[i] = L
def __processbody_URLquote(self, lines): # XXX a lot to do here: # 1. use lines directly, rather than source and dest # 2. make it clearer # 3. make it faster source = lines[:] dest = lines last_line_was_quoted=0 for i in xrange(0, len(source)): Lorig=L=source[i] ; prefix=suffix="" if L==None: continue # Italicise quot...
msgcopy['To'] = email.Utils.formataddr((name, recip))
try: name.encode('us-ascii') except UnicodeError: charset = Utils.GetCharSet(mlist.getMemberLanguage(recip)) if charset == 'us-ascii': charset = 'iso-8859-1' name = Header(name, charset).encode() name = name.encode('us-ascii', 'replace') msgcopy['To'] = formataddr((name, recip))
def verpdeliver(mlist, msg, msgdata, envsender, failures, conn): for recip in msgdata['recips']: # We now need to stitch together the message with its header and # footer. If we're VERPIng, we have to calculate the envelope sender # for each recipient. Note that the list of recipients must be of # length 1. # # BAW: ...
%s\tIGNORED
def _addvirtual(mlist, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('-unsubscribe') hostname = mlist.host_name # Set up the mailman-loop address loopaddr = Utils.get_site_email(mlist.host_name, extra='loop') loopdest = Utils.ParseEmail(loopaddr)[0] # Seek to the end of the text file, but if it's ...
""" % (hostname, loopaddr, loopdest)
""" % (loopaddr, loopdest)
def _addvirtual(mlist, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('-unsubscribe') hostname = mlist.host_name # Set up the mailman-loop address loopaddr = Utils.get_site_email(mlist.host_name, extra='loop') loopdest = Utils.ParseEmail(loopaddr)[0] # Seek to the end of the text file, but if it's ...
charset=Utils.GetCharSet(mlist.preferred_language))
charset=Utils.GetCharSet(self.preferred_language))
def HoldUnsubscription(self, addr): # Assure the database is open for writing self.__opendb() # Get the next unique id id = self.__request_id() assert not self.__db.has_key(id) # All we need to do is save the unsubscribing address self.__db[id] = (UNSUBSCRIPTION, addr) syslog('vette', '%s: held unsubscription request f...
if self.passwords.has_key(user):
user = self.members.get(self.FindUser(user)) if user and self.passwords.has_key(user):
def MailUserPassword(self, user): listfullname = '%s@%s' % (self.real_name, self.host_name) ok = 1 if self.passwords.has_key(user): recipient = self.GetMemberAdminEmail(user) subj = '%s maillist reminder\n' % listfullname # get the text from the template text = Utils.maketext( 'userpass.txt', {'user' : user, 'lis...
userlang = mlist.GetPreferredLanguage(user)
cgidata = cgi.FieldStorage() userlang = cgidata.getvalue('language', mlist.GetPreferredLanguage(user))
def main(): doc = Document() doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) parts = Utils.GetPathPieces() if not parts or len(parts) < 2: title = _('CGI script error') doc.SetTitle(title) doc.AddItem(Header(2, title)) add_error_message(doc, _('Invalid options to CGI script.')) doc.AddItem('<hr>') doc.AddItem(Mailman...
cgidata = cgi.FieldStorage()
def main(): doc = Document() doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) parts = Utils.GetPathPieces() if not parts or len(parts) < 2: title = _('CGI script error') doc.SetTitle(title) doc.AddItem(Header(2, title)) add_error_message(doc, _('Invalid options to CGI script.')) doc.AddItem('<hr>') doc.AddItem(Mailman...
userlang = cgidata.getvalue('language') if userlang not in mlist.GetAvailableLanguages(): newvals.append((SETLANGUAGE, mlist.preferred_language)) else: newvals.append((SETLANGUAGE, userlang))
if userlang not in mlist.GetAvailableLanguages(): newvals.append((SETLANGUAGE, mlist.preferred_language)) else: newvals.append((SETLANGUAGE, userlang))
def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0)
unsubscribe_errors = []
errors = []
def ChangeOptions(mlist, category, cgi_info, document): confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: mlist.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator password" d...
unsubscribe_errors.append((user, 'Not subscribed'))
errors.append((user, 'Not subscribed'))
def ChangeOptions(mlist, category, cgi_info, document): confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: mlist.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator password" d...
if not cgi_info.has_key("%s_digest" % (user)): if mlist.digest_members.has_key(user): del mlist.digest_members[user] if not mlist.members.has_key(user): mlist.members[user] = 0 else: if not mlist.digest_members.has_key(user): mlist.digest_members[user] = 0 if mlist.members.has_key(user): del mlist.members[user]
value = cgi_info.has_key('%s_digest' % user) try: mlist.SetUserDigest(user, value, force=1) except (Errors.MMNotAMemberError, Errors.MMAlreadyDigested, Errors.MMAlreadyUndigested): pass
def ChangeOptions(mlist, category, cgi_info, document): confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: mlist.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator password" d...
if unsubscribe_errors:
if errors:
def ChangeOptions(mlist, category, cgi_info, document): confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: mlist.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator password" d...
items = map(lambda x: "%s -- %s" % (x[0], x[1]), unsubscribe_errors)
items = map(lambda x: "%s -- %s" % (x[0], x[1]), errors)
def ChangeOptions(mlist, category, cgi_info, document): confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: mlist.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator password" d...
all = Utils.GetDirectories(mm_cfg.TEMPLATE_DIR)
all = mm_cfg.LC_DESCRIPTIONS.keys()
def GetConfigInfo(self, mlist, category, subcat=None): if category <> 'language': return None # Set things up for the language choices langs = mlist.GetAvailableLanguages() langnames = [_(Utils.GetLanguageDescr(L)) for L in langs] try: langi = langs.index(mlist.preferred_language) except ValueError: # Someone must have...
inner.set_charset(msg.get_charset())
def process(mlist, msg, msgdata): # Digests and Mailman-craft messages should not get additional headers if msgdata.get('isdigest') or msgdata.get('nodecorate'): return d = {} if msgdata.get('personalize'): # Calculate the extra personalization dictionary. Note that the # length of the recips list better be exactly 1....
self.__filename = None fullpath = self.fullpath() if fullpath: self.__filename = os.path.join(fullpath, 'request.db')
def __filename(self): return os.path.join(self.fullpath(), 'request.db')
def InitTempVars(self): self.__db = None self.__filename = None fullpath = self.fullpath() if fullpath: self.__filename = os.path.join(fullpath, 'request.db')
assert self.Locked() and self.__filename try: fp = open(self.__filename)
assert self.Locked() try: fp = open(filename)
def __opendb(self): if self.__db is None: assert self.Locked() and self.__filename try: fp = open(self.__filename) self.__db = marshal.load(fp) fp.close() except IOError, e: if e.errno <> errno.ENOENT: raise self.__db = {} # Migrate pre-2.1a3 held subscription records to include the # fullname data field. type, version...
fp = open(self.__filename, 'w')
fp = open(self.__filename(), 'w')
def __closedb(self): if self.__db is not None: assert self.Locked() omask = os.umask(002) try: # Save the version number self.__db['version'] = IGN, mm_cfg.REQUESTS_FILE_SCHEMA_VERSION fp = open(self.__filename, 'w') marshal.dump(self.__db, fp) fp.close() self.__db = None finally: os.umask(omask)
filename = 'heldmsg-%s-%d.txt' % (self.internal_name(), id)
filename = 'heldmsg-%s-%d.pck' % (self.internal_name(), id)
def HoldMessage(self, msg, reason, msgdata={}): # Make a copy of msgdata so that subsequent changes won't corrupt the # request database. TBD: remove the `filebase' key since this will # not be relevant when the message is resurrected. newmsgdata = {} newmsgdata.update(msgdata) msgdata = newmsgdata # assure that the d...
g = Generator(fp) g.write(msg) fp.close()
cPickle.dump(msg, fp, 1)
def HoldMessage(self, msg, reason, msgdata={}): # Make a copy of msgdata so that subsequent changes won't corrupt the # request database. TBD: remove the `filebase' key since this will # not be relevant when the message is resurrected. newmsgdata = {} newmsgdata.update(msgdata) msgdata = newmsgdata # assure that the d...
try: fp = open(path)
try: msg = readMessage(path)
def __handlepost(self, record, value, comment, preserve, forward, addr): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH) parts[0...
p = Parser(Message.Message) msg = p.parse(fp)
msg = readMessage(path)
def __handlepost(self, record, value, comment, preserve, forward, addr): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH) parts[0...
formatdate())
email.Utils.formatdate())
def __handlepost(self, record, value, comment, preserve, forward, addr): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH) parts[0...
p = Parser(Message.Message) if msg: fp.seek(0) else: try: fp = open(path) except IOError, e: if e.errno <> errno.ENOENT: raise raise Errors.LostHeldMessage(path) msg = p.parse(fp) if fp: fp.close()
try: copy = readMessage(path) except IOError, e: if e.errno <> errno.ENOENT: raise raise Errors.LostHeldMessage(path)
def __handlepost(self, record, value, comment, preserve, forward, addr): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH) parts[0...
del msg['resent-to'] msg['Resent-To'] = addr
del copy['resent-to'] copy['Resent-To'] = addr
def __handlepost(self, record, value, comment, preserve, forward, addr): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH) parts[0...
virginq.enqueue(msg, listname=self.internal_name(),
virginq.enqueue(copy, listname=self.internal_name(),
def __handlepost(self, record, value, comment, preserve, forward, addr): # For backwards compatibility with pre 2.0beta3 ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) # Handle message preservation if preserve: parts = os.path.split(path)[1].split(DASH) parts[0...
try: name.encode('us-ascii') except UnicodeError: charset = Utils.GetCharSet(mlist.getMemberLanguage(recip)) if charset == 'us-ascii': charset = 'iso-8859-1' name = Header(name, charset).encode() name = name.encode('us-ascii', 'replace')
charset = Utils.GetCharSet(mlist.getMemberLanguage(recip)) if charset == 'us-ascii': charset = 'iso-8859-1' charset = Charset(charset) if not isinstance(name, UnicodeType): name = unicode(name, charset.get_output_charset(), 'replace') name = Header(name, charset).encode()
def verpdeliver(mlist, msg, msgdata, envsender, failures, conn): for recip in msgdata['recips']: # We now need to stitch together the message with its header and # footer. If we're VERPIng, we have to calculate the envelope sender # for each recipient. Note that the list of recipients must be of # length 1. # # BAW: ...
return ""
return ''
def RestrictedListMessage(self, which, restriction): if not restriction: return "" elif restriction == 1: return _( "<i>The %(which)s is only available to the list members.</i>)") else: return _("<i>The %(which)s is only available to the list" " administrator.</i>")
"<i>The %(which)s is only available to the list members.</i>)") else: return _("<i>The %(which)s is only available to the list" " administrator.</i>")
) else: return _('''(<i>The %(which)s is only available to the list administrator.</i>)''')
def RestrictedListMessage(self, which, restriction): if not restriction: return "" elif restriction == 1: return _( "<i>The %(which)s is only available to the list members.</i>)") else: return _("<i>The %(which)s is only available to the list" " administrator.</i>")
except binascii.Error:
except (binascii.Error, TypeError):
# def (n) clever hack ;).
text)
text, lang)
def AddMember(self, userdesc, remote=None): """Front end to member subscription.
msg['MIME-Version'] = '1.0' msg.add_header('Content-Type', 'text/plain', charset=Utils.GetCharSet(lang))
def AddMember(self, userdesc, remote=None): """Front end to member subscription.
subject, text)
subject, text, lang)
def ApprovedAddMember(self, userdesc, ack=None, admin_notif=None): """Add a member right now.
subject, text)
subject, text, self.preferred_language)
def ApprovedDeleteMember(self, name, whence=None, admin_notif=None, userack=None): if userack is None: userack = self.send_goodbye_msg if admin_notif is None: admin_notif = self.admin_notify_mchanges # Delete a member, for which we know the approval has been made fullname, emailaddr = parseaddr(name) if not self.isMemb...
if not nodelete: self.removeMember(memberkey)
def changeMemberAddress(self, member, newaddress, nodelete=0): assert self.__mlist.Locked() # Make sure the old address is a member. Assertions that the new # address is not already a member is done by addNewMember() below. self.__assertIsMember(member) # Get the old values memberkey = member.lower() fullname = self.g...
self.__mlist.user_options[memberkey] = flags if not nodelete: self.removeMember(memberkey)
self.__mlist.user_options[newaddress.lower()] = flags
def changeMemberAddress(self, member, newaddress, nodelete=0): assert self.__mlist.Locked() # Make sure the old address is a member. Assertions that the new # address is not already a member is done by addNewMember() below. self.__assertIsMember(member) # Get the old values memberkey = member.lower() fullname = self.g...
From: %(author)s %(email)s
From: %(email)s (%(author)s)
def null_to_space(s): return string.replace(s, '\000', ' ')
d["body"] = string.join(self.body, "")
if not string.strip(d.get('fromdate')): d['fromdate'] = time.ctime(time.time()) if not string.strip(d.get('email')): d['email'] = 'bogus@does.not.exist.com' d['body'] = string.join(self.body, '')
def as_text(self):
<a href="%(listinfo)s">More info on this list...</a>
You can get <a href="%(listinfo)s">more information about this list</a> or you can <a href="%(fullarch)s">download the full raw archive</a> (%(size)s).
def __getstate__(self): d={} for each in self.__dict__.keys(): if each == "quote": continue if each in ['maillist','prev','next','body']: d[each] = None else: d[each] = self.__dict__[each] d['body']=[] return d
"listinfo": self.maillist.GetScriptURL('listinfo', absolute=1)
"listinfo": self.maillist.GetScriptURL('listinfo', absolute=1), "fullarch": '../%s.mbox/%s.mbox' % (listname, listname), "size": sizeof(mbox),
def html_TOC(self): d = {"listname": self.maillist.real_name, "listinfo": self.maillist.GetScriptURL('listinfo', absolute=1) } if not self.archives: d["noarchive_msg"] = '<P>Currently, there are no archives. </P>' d["archive_listing_start"] = "" d["archive_listing_end"] = "" d["archive_listing"] = "" else: d["noarchive...
try: size = os.path.getsize(file) except AttributeError: size = os.stat(file)[6] if size < 1000: sz = ' %d bytes ' % size elif size < 1000000: sz = ' %d KB ' % (size / 1000) else: sz = ' %d MB ' % (size / 1000000)
def html_TOC_entry(self, arch): # Check to see if the archive is gzip'd or not txtfile = os.path.join(mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, self.maillist.internal_name(), arch + '.txt') gzfile = txtfile + '.gz' templ = '<td><A href="%(url)s">[ %(fmt)sText%(sz)s]</a></td>' # which exists? .txt.gz first, then .txt if os.path...
'sz' : sz}
'sz' : sizeof(file), }
def html_TOC_entry(self, arch): # Check to see if the archive is gzip'd or not txtfile = os.path.join(mm_cfg.PRIVATE_ARCHIVE_FILE_DIR, self.maillist.internal_name(), arch + '.txt') gzfile = txtfile + '.gz' templ = '<td><A href="%(url)s">[ %(fmt)sText%(sz)s]</a></td>' # which exists? .txt.gz first, then .txt if os.path...
password = cgidata.getvalue('password', '').strip() if not mlist.WebAuthenticate((mm_cfg.AuthUser, mm_cfg.AuthListAdmin,
if not is_user_or_siteadmin and \ not mlist.WebAuthenticate((mm_cfg.AuthListAdmin,
def main(): doc = Document() doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) parts = Utils.GetPathPieces() lenparts = parts and len(parts) if not parts or lenparts < 1: title = _('CGI script error') doc.SetTitle(title) doc.AddItem(Header(2, title)) doc.addError(_('Invalid options to CGI script.')) doc.AddItem('<hr>')...
if globally and not is_user_or_siteadmin: doc.addError(_("""The list administrator may not change the names or addresses for this user's other subscriptions. However, the subscription for this mailing list has been changed."""), _('Note: ')) globally = False
def main(): doc = Document() doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) parts = Utils.GetPathPieces() lenparts = parts and len(parts) if not parts or lenparts < 1: title = _('CGI script error') doc.SetTitle(title) doc.AddItem(Header(2, title)) doc.addError(_('Invalid options to CGI script.')) doc.AddItem('<hr>')...
pw_globally = cgidata.getvalue('pw-globally') if pw_globally and not is_user_or_siteadmin: doc.addError(_("""The list administrator may not change the password for this user's other subscriptions. However, the password for this mailing list has been changed."""), _('Note: ')) pw_globally = False
def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0)
if cgidata.getvalue('pw-globally'):
if pw_globally:
def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0)
for gmlist in lists_of_member(mlist, user): global_options(gmlist, user, globalopts)
if not is_user_or_siteadmin: doc.addError(_("""The list administrator may not change the options for this user's other subscriptions. However the options for this mailing list subscription has been changed."""), _('Note: ')) else: for gmlist in lists_of_member(mlist, user): global_options(gmlist, user, globalopts)
def __nonzero__(self): return len(self.__dict__.keys()) > 0
_('<p>There currently are no publicly-advertised '), Link(mm_cfg.MAILMAN_URL, _('Mailman')), _(' mailing lists on %(hostname)s.'),
_('''<p>There currently are no publicly-advertised %(mailmanlink)s mailing lists on %(hostname)s.'''),
def admin_overview(msg=''): # Show the administrative overview page, with the list of all the lists on # this host. msg is an optional error message to display at the top of # the page. # # This page should be displayed in the server's default language, which # should have already been set. hostname = mm_cfg.DEFAULT_H...
_('<p>Below is the collection of publicly-advertised '), Link(mm_cfg.MAILMAN_URL, _('Mailman')), _(' mailing lists on %(hostname)s.'), _(''' Click on a list name to visit the configuration pages for that list.'''),
_('''<p>Below is the collection of publicly-advertised %(mailmanlink)s mailing lists on %(hostname)s. Click on a list name to visit the configuration pages for that list.'''),
def admin_overview(msg=''): # Show the administrative overview page, with the list of all the lists on # this host. msg is an optional error message to display at the top of # the page. # # This page should be displayed in the server's default language, which # should have already been set. hostname = mm_cfg.DEFAULT_H...
Link(mlist.GetRelativeScriptURL('admin'),
Link(mlist.GetScriptURL('admin'),
def PrintRequests(mlist, doc): # The only types of requests we know about are add member and post. # Anything else that might have gotten in here somehow we'll just ignore # (This should never happen unless someone is hacking at the code). doc.AddItem(Header(2, 'Administrative requests for mailing list: <em>' + mlist.r...
form = Form(mlist.GetRelativeScriptURL('admindb'))
form = Form(mlist.GetScriptURL('admindb'))
def PrintRequests(mlist, doc): # The only types of requests we know about are add member and post. # Anything else that might have gotten in here somehow we'll just ignore # (This should never happen unless someone is hacking at the code). doc.AddItem(Header(2, 'Administrative requests for mailing list: <em>' + mlist.r...
return member
return cpaddr
def getMemberCPAddress(self, member): cpaddr, where = self.__get_cp_member(member) if cpaddr is None: raise Errors.NotAMemberError, member return member
% ((error and "the right ") or ""))
% ((error and "right ") or ""))
def FormatAdminOverview(error=None): "Present a general welcome and itemize the (public) lists." doc = Document() legend = "%s mailing lists - Admin Links" % mm_cfg.DEFAULT_HOST_NAME doc.SetTitle(legend) table = Table(border=0, width="100%") table.AddRow([Center(Header(2, legend))]) table.AddCellInfo(max(table.GetCurr...
newparts.append(chr(int(ref[1:])))
appchr(int(ref[1:]))
def canonstr(s, lang=None): newparts = [] parts = re.split(r'&(?P<ref>[^;]+);', s) while 1: newparts.append(parts.pop(0)) if not parts: break ref = parts.pop(0) if ref.startswith('#'): newparts.append(chr(int(ref[1:]))) else: c = htmlentitydefs.entitydefs.get(ref, '?') if c.startswith('#') and c.endswith(';'): newparts...
newparts.append(chr(ref[1:-1]))
appchr(int(ref[1:-1]))
def canonstr(s, lang=None): newparts = [] parts = re.split(r'&(?P<ref>[^;]+);', s) while 1: newparts.append(parts.pop(0)) if not parts: break ref = parts.pop(0) if ref.startswith('#'): newparts.append(chr(int(ref[1:]))) else: c = htmlentitydefs.entitydefs.get(ref, '?') if c.startswith('#') and c.endswith(';'): newparts...
names = map(string.strip, string.split(name_text, '\n'))
names = filter(None, map(string.strip, string.split(name_text, '\n')))
def ChangeOptions(mlist, category, cgi_info, document): confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: mlist.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator password" d...
if a.date > maxdate.data:
if a.date > maxdate.date:
def __findParent(self, article, children = []): parentID = None if article.in_reply_to: parentID = article.in_reply_to elif article.references:
def AddToResponse(self, text, trunc=MAXCOLUMN):
def AddToResponse(self, text, trunc=MAXCOLUMN, prefix=""):
def AddToResponse(self, text, trunc=MAXCOLUMN): # only need one newline if text and text[-1] == '\n': text = text[:-1] if trunc and len(text) > trunc: text = text[:trunc-3] + '...'
if trunc and len(text) > trunc: text = text[:trunc-3] + '...' self.__respbuf = self.__respbuf + text + "\n"
for line in string.split(text, '\n'): line = prefix + line if trunc and len(line) > trunc: line = line[:trunc-3] + '...' self.__respbuf = self.__respbuf + line + "\n"
def AddToResponse(self, text, trunc=MAXCOLUMN): # only need one newline if text and text[-1] == '\n': text = text[:-1] if trunc and len(text) > trunc: text = text[:trunc-3] + '...'
self.AddToResponse(prefix + text, trunc)
self.AddToResponse(text, trunc=trunc, prefix=prefix)
def AddError(self, text, prefix='>>>>> ', trunc=MAXCOLUMN): self.__errors = self.__errors + 1 self.AddToResponse(prefix + text, trunc)
if (subject and self.__dispatch.has_key(string.split(subject)[0])):
if (subject and self.__dispatch.has_key(string.lower(string.split(subject)[0]))):
def ParseMailCommands(self):