rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
print "send: done" | def send(self, to, frm, text, headers=None): | |
ign, sender, msgsubject, givenreason, ign, ign = data | def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0) | |
doc.AddItem(mlist.GetMailmanFooter()) | def main(): doc = Document() doc.set_language(mm_cfg.DEFAULT_SERVER_LANGUAGE) parts = Utils.GetPathPieces() lenparts = len(parts) if not parts or lenparts < 1: title = _('CGI script error') doc.SetTitle(title) doc.AddItem(Header(2, title)) add_error_message(doc, _('Invalid options to CGI script.')) doc.AddItem('<hr>')... | |
_templatefilepathcache = {} | def CGIescape(arg, lang=None): if isinstance(arg, types.UnicodeType): s = Utils.websafe(arg) else: s = Utils.websafe(str(arg)) return Utils.uncanonstr(s.replace('"', '"'), lang) | |
template = _templatecache.get((templatefile, lang)) if template is None: | cachekey = (templatefile, lang, listname) filepath = _templatefilepathcache.get(cachekey) if filepath: template = _templatecache.get(filepath) if filepath is None or template is None: | def quick_maketext(templatefile, dict=None, lang=None, mlist=None): if lang is None: if mlist is None: lang = mm_cfg.DEFAULT_SERVER_LANGUAGE else: lang = mlist.preferred_language template = _templatecache.get((templatefile, lang)) if template is None: # Use the basic maketext, with defaults to get the raw template temp... |
template = Utils.maketext(templatefile, lang=lang, raw=1) _templatecache[(templatefile, lang)] = template | template, filepath = Utils.findtext(templatefile, lang=lang, raw=True, mlist=mlist) _templatefilepathcache[cachekey] = filepath _templatecache[filepath] = template | def quick_maketext(templatefile, dict=None, lang=None, mlist=None): if lang is None: if mlist is None: lang = mm_cfg.DEFAULT_SERVER_LANGUAGE else: lang = mlist.preferred_language template = _templatecache.get((templatefile, lang)) if template is None: # Use the basic maketext, with defaults to get the raw template temp... |
Utils.GetRandomSeed()), digest) | Utils.GetRandomSeed()), digest, send_ack) | def ChangeOptions(lst, category, cgi_info, document): dirty = 0 confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: lst.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator passw... |
self.ApprovedAddMember(addr, password, digest, lang) | try: self.ApprovedAddMember(addr, password, digest, lang) except Errors.MMAlreadyMember: pass | def __handlesubscription(self, record, value, comment): stime, addr, password, digest, lang = record if value == mm_cfg.DEFER: return DEFER elif value == mm_cfg.DISCARD: pass elif value == mm_cfg.REJECT: # refused self.__refuse(_('Subscription request'), addr, comment, lang=lang) else: # subscribe assert value == mm_cf... |
if isinstance(d, dict): | if not isinstance(d, dict): | def __load(self, dbfile): # Attempt to load and unserialize the specified database file. This # could actually be a config.db (for pre-2.1alpha3) or config.pck, # i.e. a marshal or a binary pickle. Actually, it could also be a # .last backup file if the primary storage file was corrupt. The # decision on whether to ... |
if not subj: | if subj: subjpref = self.subject_prefix if not re.match(re.escape(subjpref), subj, re.I): msg.SetHeader('Subject', '%s%s' % (subjpref, subj)) else: | def SendMailToNewsGroup(self, mail_msg): import Message #if self.gateway_to_news == 0: # return if self.linked_newsgroup == '' or self.nntp_host == '': raise ImproperNNTPConfigError try: if self.tmp_prevent_gate: return except AttributeError: pass # Wasn't remailed by the news gater then. Let it through. # Fork in ca... |
error_page(_('No such list <em>%s</em>') % listname) | error_page(_('No such list <em>%(listname)s</em>')) | def main(): doc = htmlformat.HeadlessDocument() parts = Utils.GetPathPieces() if not parts: error_page(_('Invalid options to CGI script')) return listname = string.lower(parts[0]) try: mlist = MailList.MailList(listname, lock=0) except Errors.MMListError, e: error_page(_('No such list <em>%s</em>') % listname) syslog... |
auth_req = (_("%s subscriber list requires authentication.") % mlist.real_name) | realname = mlist.real_name auth_req = _("%(realname)s subscriber list requires authentication.") | def main(): doc = htmlformat.HeadlessDocument() parts = Utils.GetPathPieces() if not parts: error_page(_('Invalid options to CGI script')) return listname = string.lower(parts[0]) try: mlist = MailList.MailList(listname, lock=0) except Errors.MMListError, e: error_page(_('No such list <em>%s</em>') % listname) syslog... |
bad = (_("%s subscriber authentication failed.") % mlist.real_name) | bad = _( "%(realname)s subscriber authentication failed.") | def main(): doc = htmlformat.HeadlessDocument() parts = Utils.GetPathPieces() if not parts: error_page(_('Invalid options to CGI script')) return listname = string.lower(parts[0]) try: mlist = MailList.MailList(listname, lock=0) except Errors.MMListError, e: error_page(_('No such list <em>%s</em>') % listname) syslog... |
bad = (_("%s admin authentication failed.") % mlist.real_name) | bad = _("%(realname)s admin authentication failed.") | def main(): doc = htmlformat.HeadlessDocument() parts = Utils.GetPathPieces() if not parts: error_page(_('Invalid options to CGI script')) return listname = string.lower(parts[0]) try: mlist = MailList.MailList(listname, lock=0) except Errors.MMListError, e: error_page(_('No such list <em>%s</em>') % listname) syslog... |
addrs = getaddresses([self[h]]) realname, address = addrs[0] | fieldval = self[h] if not fieldval: continue addrs = getaddresses([fieldval]) try: realname, address = addrs[0] except IndexError: continue | def get_sender(self, use_envelope=None, preserve_case=0): """Return the address considered to be the author of the email. |
"""Prepares the message for sending by enqueing it to the `virgin' queue. | """Sends the message by enqueuing it to the `virgin' queue. | def send(self, mlist, **_kws): """Prepares the message for sending by enqueing it to the `virgin' queue. |
"Your subscription request has been forwarded the" | "Your subscription request has been forwarded to the" | def ProcessSubscribeCmd(self, args, cmd, mail): """Parse subscription request and send confirmation request.""" |
raise Errors.DiscardMessage | dispose(mlist, msg, msgdata, _("The message's content type was explicitly disallowed")) | def process(mlist, msg, msgdata): # Short-circuits if not mlist.filter_content: return if msgdata.get('isdigest'): return # We also don't care about our own digests or plaintext ctype = msg.get_content_type() mtype = msg.get_content_maintype() # Check to see if the outer type matches one of the filter types filtertypes... |
raise Errors.DiscardMessage | dispose(mlist, msg, msgdata, _("The message's content type was not explicitly allowed")) | def process(mlist, msg, msgdata): # Short-circuits if not mlist.filter_content: return if msgdata.get('isdigest'): return # We also don't care about our own digests or plaintext ctype = msg.get_content_type() mtype = msg.get_content_maintype() # Check to see if the outer type matches one of the filter types filtertypes... |
raise Errors.DiscardMessage | dispose(mlist, msg, msgdata, _("After content filtering, the message was empty")) | def process(mlist, msg, msgdata): # Short-circuits if not mlist.filter_content: return if msgdata.get('isdigest'): return # We also don't care about our own digests or plaintext ctype = msg.get_content_type() mtype = msg.get_content_maintype() # Check to see if the outer type matches one of the filter types filtertypes... |
def __init__(self, recip, sender, subject=None, text=None): | def __init__(self, recip, sender, subject=None, text=None, lang=None): | def __init__(self, recip, sender, subject=None, text=None): Message.__init__(self) if text is not None: self.set_payload(text) if subject is None: subject = '(no subject)' self['Subject'] = subject self['From'] = sender if isinstance(recip, ListType): self['To'] = COMMASPACE.join(recip) self.recips = recip else: self['... |
self.set_payload(text) | self.set_payload(text, charset) | def __init__(self, recip, sender, subject=None, text=None): Message.__init__(self) if text is not None: self.set_payload(text) if subject is None: subject = '(no subject)' self['Subject'] = subject self['From'] = sender if isinstance(recip, ListType): self['To'] = COMMASPACE.join(recip) self.recips = recip else: self['... |
self['Subject'] = subject | self['Subject'] = Header(subject, charset, header_name='Subject') | def __init__(self, recip, sender, subject=None, text=None): Message.__init__(self) if text is not None: self.set_payload(text) if subject is None: subject = '(no subject)' self['Subject'] = subject self['From'] = sender if isinstance(recip, ListType): self['To'] = COMMASPACE.join(recip) self.recips = recip else: self['... |
import OutgoingQueue | def TrySMTPDelivery(recipient, sender, text, queue_entry): import smtplib try: con = smtplib.SmtpConnection(mm_cfg.SMTPHOST) con.helo(mm_cfg.DEFAULT_HOST_NAME) con.send(to=recipient,frm=sender,text=text) con.quit() import OutgoingQueue OutgoingQueue.dequeueMessage(queue_entry) finally: | |
finally: pass | except socket.error: pass except: OutgoingQueue.dequeueMessage(queue_entry) import sys e = sys.exc_info() from Logging.Logger import Logger Logger("error").write( "TrySMTPDelivery: bad smtp delivery to %s\n\t%s/%s\n" % (recipient, e[0], e[1])) | def TrySMTPDelivery(recipient, sender, text, queue_entry): import smtplib try: con = smtplib.SmtpConnection(mm_cfg.SMTPHOST) con.helo(mm_cfg.DEFAULT_HOST_NAME) con.send(to=recipient,frm=sender,text=text) con.quit() import OutgoingQueue OutgoingQueue.dequeueMessage(queue_entry) finally: |
href="http://www.metasystema.org/essays/reply-to-useful.mhtml">Reply-To | href="http://www.metasystema.net/essays/reply-to.mhtml">Reply-To | def GetConfigInfo(self, mlist, category, subcat): if category <> 'general': return None WIDTH = mm_cfg.TEXTFIELDWIDTH |
lock.unlock() | lock.unlock(unconditionally=1) | def new(*content): """Create a new entry in the pending database, returning cookie for it.""" # It's a programming error if this assertion fails! We do it this way so # the assert test won't fail if the sequence is empty. assert content[:1] in _ALLKEYS # Acquire the pending database lock, letting TimeOutError percolat... |
lock.unlock() | lock.unlock(unconditionally=1) | def confirm(cookie, expunge=1): """Return data for cookie, or None if not found. If optional expunge is true (the default), the record is also removed from the database. """ # Acquire the pending database lock, letting TimeOutError percolate up. # BAW: we perhaps shouldn't acquire the lock if expunge==0. lock = LockFi... |
fp = StringIO(str(msg)) | fp = StringIO(msg.as_string()) | def _dispose(self, mlist, msg, msgdata): if not msgdata.get('prepped'): prepare_message(mlist, msg, msgdata) try: # Flatten the message object, sticking it in a StringIO object fp = StringIO(str(msg)) conn = None try: try: conn = nntplib.NNTP(mlist.nntp_host, readermode=1, user=mm_cfg.NNTP_USERNAME, password=mm_cfg.NNT... |
def reset(self, score=0, date=None, noticesleft=None): if date is None: date = ZEROHOUR_PLUSONEDAY | def reset(self, score, date, noticesleft): | def reset(self, score=0, date=None, noticesleft=None): if date is None: date = ZEROHOUR_PLUSONEDAY self.score = score self.date = date if noticesleft is not None: self.noticesleft = noticesleft self.lastnotice = ZEROHOUR_PLUSONEDAY |
if noticesleft is not None: self.noticesleft = noticesleft | self.noticesleft = noticesleft | def reset(self, score=0, date=None, noticesleft=None): if date is None: date = ZEROHOUR_PLUSONEDAY self.score = score self.date = date if noticesleft is not None: self.noticesleft = noticesleft self.lastnotice = ZEROHOUR_PLUSONEDAY |
info.reset(noticesleft=mlist.bounce_you_are_disabled_warnings) | info.reset(weight, today, self.bounce_you_are_disabled_warnings) | def registerBounce(self, member, msg, weight=1.0): if not self.isMember(member): return info = self.getBounceInfo(member) today = time.localtime()[:3] if not isinstance(info, _BounceInfo): # This is the first bounce we've seen from this member cookie = Pending.new(Pending.RE_ENABLE, self.internal_name(), member) info =... |
self.archive = 1 | self.archive = mm_cfg.DEFAULT_ARCHIVE | def InitVars(self): |
list.digest_members.remove(user) | lst.digest_members.remove(user) | def ChangeOptions(lst, category, cgi_info, document): dirty = 0 confirmed = 0 if cgi_info.has_key('newpw'): if cgi_info.has_key('confirmpw'): if cgi_info.has_key('adminpw'): try: lst.ConfirmAdminPassword(cgi_info['adminpw'].value) confirmed = 1 except Errors.MMBadPasswordError: m = "Error: incorrect administrator passw... |
self.Lock() self.InitVars(name, admin, crypted_password) self._ready = 1 self.InitTemplates() self.Save() self.CreateFiles() def CreateFiles(self): | self.__lock.lock() self.InitVars(name, admin, crypted_password) self._ready = 1 self.InitTemplates() self.Save() | def Create(self, name, admin, crypted_password): |
open(os.path.join(mm_cfg.LOCK_DIR, '%s.lock' % self._internal_name), 'a+').close() open(os.path.join(self._full_path, "next-digest"), "a+").close() open(os.path.join(self._full_path, "next-digest-topics"), "a+").close() | path = os.path.join(self._full_path, 'next-digest') fp = open(path, "a+") fp.close() fp = open(path+'-topics', "a+") fp.close() | def CreateFiles(self): |
d["author_html"] = self.quote(self.author) d["email_url"] = url_quote(self.email) | if mm_cfg.ARCHIVER_OBSCURES_EMAILADDRS: author = re.sub('@', _(' at '), self.author) emailurl = self._mlist.GetListEmail() else: author = self.author emailurl = self.email d["author_html"] = self.quote(author) d["email_url"] = url_quote(emailurl) | def as_html(self): d = self.__dict__.copy() # avoid i18n side-effects otrans = i18n.get_translation() i18n.set_language(self._lang) try: d["prev"], d["prev_wsubj"] = self._get_prev() d["next"], d["next_wsubj"] = self._get_next() |
db = HyperDatabase.HyperDatabase(dir) | db = HyperDatabase.HyperDatabase(dir, maillist) | def __init__(self, maillist): # can't init the database while other processes are writing to it! # XXX TODO- implement native locking # with mailman's LockFile module for HyperDatabase.HyperDatabase # dir = maillist.archive_dir() db = HyperDatabase.HyperDatabase(dir) self.__super_init(dir, reload=1, database=db) |
L2="" ; jr=emailpat.search(L) ; kr=urlpat.search(L) while jr!=None or kr!=None: if jr==None: j=-1 else: j = jr.start(0) if kr==None: k=-1 else: k = kr.start(0) if j!=-1 and (j<k or k==-1): text=jr.group(1) ; URL='mailto:'+text ; pos=j elif k!=-1 and (j>k or j==-1): text=URL=kr.group(1) ; pos=k | L2="" jr = emailpat.search(L) kr = urlpat.search(L) while jr != None or kr != None: if jr == None: j = -1 else: j = jr.start(0) if kr == None: k = -1 else: k = kr.start(0) if j != -1 and (j < k or k == -1): text = jr.group(1) URL = 'mailto:' + text pos = j elif k!=-1 and (j>k or j==-1): text = URL = kr.group(1) pos=k | 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... |
from Mailman.mm_cfg import MAILMAN_UID | from Mailman.mm_cfg import MAILMAN_UID, MAILMAN_GID | def main(argv): binpath = paths.prefix + '/bin/' droplib = binpath + 'CheckFixUid.py' if len(argv) < 2 or argv[1] != "-f": print __doc__ sys.exit(1) if not os.path.exists(droplib): print "Creating " + droplib fp = open(droplib, 'w', 0644) fp.write("""import sys |
fp.close | fp.close() | def main(argv): binpath = paths.prefix + '/bin/' droplib = binpath + 'CheckFixUid.py' if len(argv) < 2 or argv[1] != "-f": print __doc__ sys.exit(1) if not os.path.exists(droplib): print "Creating " + droplib fp = open(droplib, 'w', 0644) fp.write("""import sys |
result[string.lower(k)] = v | result[k.lower()] = v | def CaseInsensitiveKeyedDict(d): result = {} for (k,v) in d.items(): result[string.lower(k)] = v return result |
output = output + ' %s="%s"' %(string.upper(key), val) | output = output + ' %s="%s"' % (key.upper(), val) | def ExtractCellInfo(self, info): |
output = output + ' %s="%s"' %(string.upper(key), val) | output = output + ' %s="%s"' % (key.upper(), val) | def ExtractRowInfo(self, info): |
output = output + ' %s="%s"' %(string.upper(key), val) | output = output + ' %s="%s"' % (key.upper(), val) | def ExtractTableInfo(self, info): |
output = '<font %s>' % string.join(seq, ' ') | output = '<font %s>' % SPACE.join(seq) | def Format(self, indent=0): |
return string.join(output, '') | return EMPTYSTRING.join(output) | def Format(self, indent=0): output = [] for item in self.items: output.append(HTMLFormatObject(item, indent)) return string.join(output, '') |
bgcolor = mm_cfg.WEB_BGCOLOR | bgcolor = mm_cfg.WEB_BG_COLOR | def Format(self, indent=0): return ('<div align="%s">' % self.align) + \ Container.Format(self, indent) + \ '</div>' |
output.append('%s<BODY %s>' % (tab, string.join(quals, ' '))) | output.append('%s<BODY %s>' % (tab, SPACE.join(quals))) | def Format(self, indent=0, **kws): kws.setdefault('bgcolor', self.bgcolor) tab = ' ' * indent output = [self.get_content_type(), '', tab, '<HTML>', '<HEAD>' ] if self.title: output.append('%s<TITLE>%s</TITLE>' % (tab, self.title)) output.append('%s</HEAD>' % tab) output.append('%s<BODY' % tab) |
return string.join(output, '\n') | return NL.join(output) | def Format(self, indent=0, **kws): kws.setdefault('bgcolor', self.bgcolor) tab = ' ' * indent output = [self.get_content_type(), '', tab, '<HTML>', '<HEAD>' ] if self.title: output.append('%s<TITLE>%s</TITLE>' % (tab, self.title)) output.append('%s</HEAD>' % tab) output.append('%s<BODY' % tab) |
return string.join(output, ' ') | return SPACE.join(output) | def Format(self, indent=0): |
return string.join(self.headers, '') + '\n' + self.body | return self.unixfrom + string.join(self.headers, '') + '\n' + self.body | def __str__(self): # TBD: should this include the unixfrom? return string.join(self.headers, '') + '\n' + self.body |
handle_no_list(doc, _('No such list <em>%s</em><p>') % listname) | handle_no_list(doc, _('No such list <em>%(listname)s</em><p>')) | def main(): doc = Document() # figure out which list we're going to process parts = Utils.GetPathPieces() if not parts: handle_no_list(doc) return # get URL components. the list name should be the zeroth part try: listname = string.lower(parts[0]) except IndexError: handle_no_list(doc) return # now that we have the li... |
mlist.preferred_language, raw=1)) | lang=mlist.preferred_language, raw=1)) | 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>' +... |
loopaddr = Utils.get_site_email(mlist.host_name, 'loop') | loopaddr = Utils.ParseEmail(Utils.get_site_email(extra='loop'))[0] | def addlist(mlist, db, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('-request') loopaddr = Utils.get_site_email(mlist.host_name, 'loop') loopmbox = os.path.join(mm_cfg.DATA_DIR, 'owner-bounces.mbox') # Seek to the end of the text file, but if it's empty write the standard # disclaimer, and the lo... |
print >> fp, ' print >> fp, '%s: %s' % (Utils.ParseEmail(loopaddr)[0], loopmbox) | print >> fp, ' print >> fp, '%s: %s' % (loopaddr, loopmbox) | def addlist(mlist, db, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('-request') loopaddr = Utils.get_site_email(mlist.host_name, 'loop') loopmbox = os.path.join(mm_cfg.DATA_DIR, 'owner-bounces.mbox') # Seek to the end of the text file, but if it's empty write the standard # disclaimer, and the lo... |
db[loopaddr + '\0'] = loopmbox + '\0' | def addlist(mlist, db, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('-request') loopaddr = Utils.get_site_email(mlist.host_name, 'loop') loopmbox = os.path.join(mm_cfg.DATA_DIR, 'owner-bounces.mbox') # Seek to the end of the text file, but if it's empty write the standard # disclaimer, and the lo... | |
loopaddr = Utils.get_site_email(mlist.host_name, 'loop') mailbox, domain = Utils.ParseEmail(loopaddr) | loopaddr = Utils.get_site_email(mlist.host_name, extra='loop') loopdest = Utils.ParseEmail(loopaddr)[0] | def addvirtual(mlist, db, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('request') hostname = mlist.host_name loopaddr = Utils.get_site_email(mlist.host_name, 'loop') mailbox, domain = Utils.ParseEmail(loopaddr) # Seek to the end of the text file, but if it's empty write the standard # disclaimer,... |
""" print >> fp, hostname, '\tIGNORE' print >> fp, ' print >> fp, '%s: %s' % (loopaddr, mailbox) print >> fp db[hostname + '\0'] = 'IGNORE\0' db[loopaddr + '\0'] = loopaddr + '\0' | %s\t%s """ % (loopaddr, loopdest) db[loopaddr + '\0'] = loopdest + '\0' | def addvirtual(mlist, db, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('request') hostname = mlist.host_name loopaddr = Utils.get_site_email(mlist.host_name, 'loop') mailbox, domain = Utils.ParseEmail(loopaddr) # Seek to the end of the text file, but if it's empty write the standard # disclaimer,... |
print >> fp, fqdnaddr + ':', ((fieldsz - len(k) + 1) * ' '), k | print >> fp, fqdnaddr, ((fieldsz - len(k) + 1) * ' '), '\t', k | def addvirtual(mlist, db, fp): listname = mlist.internal_name() fieldsz = len(listname) + len('request') hostname = mlist.host_name loopaddr = Utils.get_site_email(mlist.host_name, 'loop') mailbox, domain = Utils.ParseEmail(loopaddr) # Seek to the end of the text file, but if it's empty write the standard # disclaimer,... |
db = dbhash.open(dbfile, 'c') | db = bsddb.hashopen(dbfile, 'c') | def do_create(mlist, dbfile, textfile, func): lockfp = None try: # First, open the dbhash file using built-in open so we can acquire an # exclusive lock on it. See the discussion above for why we do it # this way instead of specifying the `l' option to dbhash.open() lockfp = open(dbfile) fcntl.flock(lockfp.fileno(), f... |
fp.close() | db.close() | def do_create(mlist, dbfile, textfile, func): lockfp = None try: # First, open the dbhash file using built-in open so we can acquire an # exclusive lock on it. See the discussion above for why we do it # this way instead of specifying the `l' option to dbhash.open() lockfp = open(dbfile) fcntl.flock(lockfp.fileno(), f... |
if mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: dbfile, textfile = virtual_files(mlist.host_name) do_create(mlist, dbfile, textfile, addvirtual) | if mlist.host_name in mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: do_create(mlist, VDBFILE, VTEXTFILE, addvirtual) | def create(mlist, cgi=0, nolock=0): # Acquire the global list database lock lock = None if not nolock: lock = makelock() lock.lock() # Do the aliases file, which need to be done in any case try: do_create(mlist, DBFILE, TEXTFILE, addlist) if mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: dbfile, textfile = virtual_files(mlist.h... |
db = dbhash.open(dbfile, 'c') | db = bsddb.hashopen(dbfile, 'c') | def do_remove(mlist, dbfile, textfile, virtualp): lockfp = None try: listname = mlist.internal_name() # Crack open the dbhash file, and delete all the entries. See the # discussion above for while we lock the aliases.db file this way. lockfp = open(dbfile) fcntl.flock(lockfp.fileno(), fcntl.LOCK_EX) db = dbhash.open(d... |
if mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: | if mlist.host_name in mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: | def remove(mlist, cgi=0): # Acquire the global list database lock lock = makelock() lock.lock() try: do_remove(mlist, DBFILE, TEXTFILE, 0) if mm_cfg.POSTFIX_STYLE_VIRTUAL_DOMAINS: do_remove(mlist, VDBFILE, VTEXTFILE, 1) finally: lock.unlock(unconditionally=1) |
your membership administrative address, %s. ''') % self.GetMemberAdminEmail(name)) | your membership administrative address, %(addr)s.''')) | def SendSubscribeAck(self, name, password, digest): pluser = self.GetPreferredLanguage(name) os.environ['LANG'] = pluser if not self.send_welcome_msg: return |
}, pluser) | }, lang=pluser) | def SendSubscribeAck(self, name, password, digest): pluser = self.GetPreferredLanguage(name) os.environ['LANG'] = pluser if not self.send_welcome_msg: return |
digmode = _(" (Digest mode)") | digmode = _(' (Digest mode)') | def SendSubscribeAck(self, name, password, digest): pluser = self.GetPreferredLanguage(name) os.environ['LANG'] = pluser if not self.send_welcome_msg: return |
_('Unsubscribed from "%s" mailing list') % self.real_name, | _('Unsubscribed from "%(realname)s" mailing list'), | def SendUnsubscribeAck(self, name): os.environ['LANG'] = self.GetPreferredLanguage(name) msg = Message.UserNotification( self.GetMemberAdminEmail(name), self.GetAdminEmail(), _('Unsubscribed from "%s" mailing list') % self.real_name, Utils.wrap(self.goodbye_msg)) msg.send(self) |
Link(self.GetScriptURL('listinfo'), self.real_name), _(' list run by '), Link('mailto:' + self.GetOwnerEmail(), ownertext), | innertext, | def GetMailmanFooter(self): ownertext = COMMASPACE.join([Utils.ObscureEmail(a, 1) for a in self.owner]) # Remove the .Format() when htmlformat conversion is done. realname = self.real_name hostname = self.host_name return Container( '<hr>', Address( Container( Link(self.GetScriptURL('listinfo'), self.real_name), _(' li... |
self.host_name = config.DEFAULT_HOST_NAME or config.DEFAULT_EMAIL_HOST | if not hasattr(self, 'host_name'): self.host_name = config.DEFAULT_HOST_NAME or \ config.DEFAULT_EMAIL_HOST | def InitVars(self, name=None, admin='', crypted_password=''): """Assign default values - some will be overriden by stored state.""" # Non-configurable list info if name: self._internal_name = name |
self.host_name = email_host | def Create(self, fqdn_listname, admin_email, crypted_password, langs=None): # Validate the list's posting address, which should be fqdn_listname. # If that's invalid, do not create any of the mailing list artifacts # (the subdir in lists/ and the subdirs in archives/public and # archives/private. Most scripts already ... | |
REpat = re.compile( r"\s*RE\s*:\s*", re.IGNORECASE) | REpat = re.compile( r"\s*RE\s*(\[\d+\]\s*)?:\s*", re.IGNORECASE) | def CGIescape(arg): s = cgi.escape(str(arg)) return string.replace(s, '"', '"') |
return self.__getmsgids(mm_cfg.HELDMSG) | return self.__getmsgids(HELDMSG) | def GetHeldMessageIds(self): return self.__getmsgids(mm_cfg.HELDMSG) |
return self.__getmsgids(mm_cfg.SUBSCRIPTION) | return self.__getmsgids(SUBSCRIPTION) | def GetSubscriptionIds(self): return self.__getmsgids(mm_cfg.SUBSCRIPTION) |
if rtype == mm_cfg.HELDMSG: | if rtype == HELDMSG: | def HandleRequest(self, id, value, comment): self.__opendb() rtype, data = self.__db[id] del self.__db[id] if rtype == mm_cfg.HELDMSG: self.__handlepost(data, value, comment) else: assert rtype == mm_cfg.SUBSCRIPTION self.__handlesubscription(data, value, comment) |
assert rtype == mm_cfg.SUBSCRIPTION | assert rtype == SUBSCRIPTION | def HandleRequest(self, id, value, comment): self.__opendb() rtype, data = self.__db[id] del self.__db[id] if rtype == mm_cfg.HELDMSG: self.__handlepost(data, value, comment) else: assert rtype == mm_cfg.SUBSCRIPTION self.__handlesubscription(data, value, comment) |
sender, text = Utils.SnarfMessage(msg) | sender = msg.GetSender() filename = 'heldmsg-%s-%d.txt' % (self.internal_name(), id) omask = os.umask(002) try: fp = open(os.path.join(mm_cfg.DATA_DIR, filename), 'w') fp.write(str(msg)) fp.close() finally: os.umask(omask) | def HoldMessage(self, msg, reason): # assure that the database is open for writing self.__opendb() # get the next unique id id = self.__request_id() assert not self.__db.has_key(id) # flatten the message and suck out the sender address sender, text = Utils.SnarfMessage(msg) # save the information to the request databas... |
data = time.time(), sender, msgsubject, reason, text self.__db[id] = (mm_cfg.HELDMSG, data) | data = time.time(), sender, msgsubject, reason, filename self.__db[id] = (HELDMSG, data) | def HoldMessage(self, msg, reason): # assure that the database is open for writing self.__opendb() # get the next unique id id = self.__request_id() assert not self.__db.has_key(id) # flatten the message and suck out the sender address sender, text = Utils.SnarfMessage(msg) # save the information to the request databas... |
ptime, sender, subject, reason, text = record | ptime, sender, subject, reason, filename = record path = os.path.join(mm_cfg.DATA_DIR, filename) | def __handlepost(self, record, value, comment): ptime, sender, subject, reason, text = record rejection = None if value == 0: # Approved msg = Message.Message(StringIO(text)) msg.approved = 1 self.Post(msg) elif value == 1: # Rejected rejection = 'Refused' if not self.dont_respond_to_post_requests: self.__refuse('Posti... |
msg = Message.Message(StringIO(text)) | try: fp = open(path) except IOError: raise Errors.LostHeldMessage(path) msg = Message.Message(fp) | def __handlepost(self, record, value, comment): ptime, sender, subject, reason, text = record rejection = None if value == 0: # Approved msg = Message.Message(StringIO(text)) msg.approved = 1 self.Post(msg) elif value == 1: # Rejected rejection = 'Refused' if not self.dont_respond_to_post_requests: self.__refuse('Posti... |
try: os.unlink(path) except os.error, (code, msg): if code == ENOENT: raise Errors.LostHeldMessage(path) raise | def strquote(s): return string.replace(s, '%', '%%') | |
self.__db[id] = (mm_cfg.SUBSCRIPTION, data) | self.__db[id] = (SUBSCRIPTION, data) | def HoldSubscription(self, addr, password, digest): # assure that the database is open for writing self.__opendb() # get the next unique id id = self.__request_id() assert not self.__db.has_key(id) # # save the information to the request database. for held subscription # entries, each record in the database will be one... |
msgdata['rejection-notice'] = Utils.wrap(exc.rejection_notice(mlist)) | msgdata['rejection_notice'] = Utils.wrap(exc.rejection_notice(mlist)) | def hold_for_approval(mlist, msg, msgdata, exc): # BAW: This should really be tied into the email confirmation system so # that the message can be approved or denied via email as well as the # web. if type(exc) is ClassType: # Go ahead and instantiate it now. exc = exc() listname = mlist.real_name sender = msgdata.get(... |
if not msg.get('x-mailman-version'): | if not msg.has_key('x-mailman-version'): | def process(mlist, msg, msgdata): # Set the "X-Ack: no" header if noack flag is set. if msgdata.get('noack'): del msg['x-ack'] msg['X-Ack'] = 'no' # Because we're going to modify various important headers in the email # message, we want to save some of the information in the msgdata # dictionary for later. Specificall... |
if not msg.get('precedence'): msg['Precedence'] = 'bulk' | if not msg.has_key('precedence'): msg['Precedence'] = 'list' | def process(mlist, msg, msgdata): # Set the "X-Ack: no" header if noack flag is set. if msgdata.get('noack'): del msg['x-ack'] msg['X-Ack'] = 'no' # Because we're going to modify various important headers in the email # message, we want to save some of the information in the msgdata # dictionary for later. Specificall... |
fp.write(subpart.get_payload()) | fp.write(subpart.get_payload(decode=1)) | def to_plaintext(msg): changedp = 0 for subpart in typed_subpart_iterator(msg, 'text', 'html'): filename = tempfile.mktemp('.html') fp = open(filename, 'w') try: fp.write(subpart.get_payload()) fp.close() cmd = os.popen(mm_cfg.HTML_TO_PLAIN_TEXT_COMMAND % {'filename': filename}) plaintext = cmd.read() rtn = cmd.close()... |
status = cmdproc.close() | try: status = cmdproc.close() except IOError, (code, msg): if errcode <> errno.ECHILD: Utils.reraise() status = 0 | def DeliverToList(self, msg, recipients, header="", footer="", remove_to=0, tmpfile_prefix = ""): |
return self.__conn.sendmail(envsender, recips, msgtext) | results = self.__conn.sendmail(envsender, recips, msgtext) | def sendmail(self, envsender, recips, msgtext): try: return self.__conn.sendmail(envsender, recips, msgtext) except smtplib.SMTPException: # For safety, reconnect self.__conn.quit() self.__connect() # Let exceptions percolate up raise # Decrement the session counter, reconnecting if necessary self.__numsessions -= 1 # ... |
Decorate.process(mlist, msg, msgdata) | if not msgdata.get('decorated'): Decorate.process(mlist, msg, msgdata) msgdata['decorated'] = 1 | def process(mlist, msg, msgdata): recips = msgdata.get('recips') if not recips: # Nobody to deliver to! return # Calculate the non-VERP envelope sender. if mlist: envsender = mlist.GetBouncesEmail() else: envsender = Utils.get_site_email(extra='bounces') # Time to split up the recipient list. If we're personalizing or... |
numsessions = mm_cfg.SMTP_MAX_SESSIONS_PER_CONNECTION | def process(mlist, msg, msgdata): recips = msgdata.get('recips') if not recips: # Nobody to deliver to! return # Calculate the non-VERP envelope sender. if mlist: envsender = mlist.GetBouncesEmail() else: envsender = Utils.get_site_email(extra='bounces') # Time to split up the recipient list. If we're personalizing or... | |
legend = "%s mailing lists" % mm_cfg.DEFAULT_HOST_NAME | legend = "%s mailing lists" % host_name | def FormatListinfoOverview(error=None): "Present a general welcome and itemize the (public) lists for this host." doc = Document() legend = "%s mailing lists" % mm_cfg.DEFAULT_HOST_NAME doc.SetTitle(legend) table = Table(border=0, width="100%") table.AddRow([Center(Header(2, legend))]) table.AddCellInfo(max(table.GetC... |
if os.environ.has_key('HTTP_HOST'): http_host = os.environ['HTTP_HOST'] else: http_host = None | def FormatListinfoOverview(error=None): "Present a general welcome and itemize the (public) lists for this host." doc = Document() legend = "%s mailing lists" % mm_cfg.DEFAULT_HOST_NAME doc.SetTitle(legend) table = Table(border=0, width="100%") table.AddRow([Center(Header(2, legend))]) table.AddCellInfo(max(table.GetC... | |
" mailing lists on %s." % mm_cfg.DEFAULT_HOST_NAME, | " mailing lists on %s." % host_name, | def FormatListinfoOverview(error=None): "Present a general welcome and itemize the (public) lists for this host." doc = Document() legend = "%s mailing lists" % mm_cfg.DEFAULT_HOST_NAME doc.SetTitle(legend) table = Table(border=0, width="100%") table.AddRow([Center(Header(2, legend))]) table.AddCellInfo(max(table.GetC... |
if got == 0: | if got == None: normalized = self.FindUser(user) elif type(got) == types.StringType: normalized = got else: | def ConfirmUserPassword(self, user, pw): """True if password is valid for site, list admin, or specific user.""" if self.ValidAdminPassword(pw): return 1 # We need to obtain the right letter-case translated version, if any: got = self.members.get(string.lower(user), None) if got == None: got = self.digest_members.get(s... |
elif got == None: normalized = self.FindUser(user) else: normalized = got | def ConfirmUserPassword(self, user, pw): """True if password is valid for site, list admin, or specific user.""" if self.ValidAdminPassword(pw): return 1 # We need to obtain the right letter-case translated version, if any: got = self.members.get(string.lower(user), None) if got == None: got = self.digest_members.get(s... | |
tempfile.template = TEMPLATE | tempfile.template = "%s%d." % (TEMPLATE, os.getpid()) | def enqueueMessage(the_sender, recip, text): tempfile.tempdir = mm_cfg.DATA_DIR tempfile.template = TEMPLATE fname = tempfile.mktemp() f = open(fname, "a+") os.chmod(fname, QF_MODE | stat.S_ISUID) # make sure this is set right off the bat marshal.dump((recip,the_sender,text),f) f.close() os.chmod(fname, QF_MODE | stat.... |
msg = _('A confirmation message has been sent to %(newaddr)s') | msg = _('A confirmation message has been sent to %(newaddr)s. ') | def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0) |
else: subject = CGIescape(article.subject) author = CGIescape(article.author) | subject = CGIescape(article.subject) author = CGIescape(article.author) | def write_index_entry(self, article): if article.charset == self.charset: d = article.decoded subject = d.get("subject", article.subject) author = d.get("author", article.author) else: subject = CGIescape(article.subject) author = CGIescape(article.author) print index_entry_template % (urllib.quote(article.filename), s... |
info = _BounceInfo(member, weight, today, 0) | info.score = weight info.date = today info.noticesleft = 0 info.lastnotice = None | def registerBounce(self, member, msg, weight=1.0): if not self.isMember(member): return info = self.getBounceInfo(member) today = time.localtime()[:3] if info is None: # This is the first bounce we've seen from this member cookie = Pending.new(Pending.RE_ENABLE, self.internal_name(), member) info = _BounceInfo(member, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.