rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
results = results + \ _("This list only supports digest subscriptions!")
results += _("This list only supports digest subscriptions!")
def process_form(mlist, doc): form = cgi.FieldStorage() error = 0 results = '' # Preliminaries done, actual processing of the form input below. if form.has_key("language"): language = form["language"].value else: language = mlist.preferred_language os.environ['LANG'] = language if form.has_key("UserOptions") or \ fo...
results = results + \ _("You have been successfully subscribed to %s.") % \ (mlist.real_name) PrintResults(mlist, results, doc, language) def PrintResults(mlist, results, doc, lang=None): if lang is None: lang = mlist.preferred_language
rname = mlist.real_name results += _("You have been successfully subscribed to %(rname)s.") print_results(mlist, results, doc, lang) def print_results(mlist, results, doc, lang):
def process_form(mlist, doc): form = cgi.FieldStorage() error = 0 results = '' # Preliminaries done, actual processing of the form input below. if form.has_key("language"): language = form["language"].value else: language = mlist.preferred_language os.environ['LANG'] = language if form.has_key("UserOptions") or \ fo...
msg.SetHeader('Subject', '%s(no subject)' % prefix)
msg.SetHeader('Subject', '%s(no subject)' % subjpref)
def SendMailToNewsGroup(self, mail_msg): import Message error = [] if not self.linked_newsgroup: error.append('no newsgroup') if not self.nntp_host: error.append('no NNTP host') if error: msg = 'NNTP gateway improperly configured: ' + \ string.join(error, ', ') self.LogMsg('error', msg) return if hasattr(mail_msg, 'fro...
output = output + ' %s=%s' %(string.upper(key), val)
output = output + ' %s="%s"' %(string.upper(key), val)
def ExtractCellInfo(self, info):
output = output + ' %s=%s' %(string.upper(key), val)
output = output + ' %s="%s"' %(string.upper(key), val)
def ExtractRowInfo(self, info):
output = output + ' %s=%s' %(string.upper(key), val)
output = output + ' %s="%s"' %(string.upper(key), val)
def ExtractTableInfo(self, info):
output = output + '%s</html>\n' % spaces
output = output + '%s</body>\n%s</html>\n' % (spaces, spaces)
def Format(self, indent=0, **kw):
_('<br>(Details for <b>%s</b>)' % varname)).Format()
_('<br>(Details for <b>%(varname)s</b>)')).Format()
def get_item_gui_description(mlist, category, subcat, varname, descr, detailsp): # Return the item's description, with link to details. # # Details are not included if this is a VARHELP page, because that /is/ # the details page! if detailsp: if subcat: varhelp = '/?VARHELP=%s/%s/%s' % (category, subcat, varname) else:...
colspan=10,
colspan=OPTCOLUMNS,
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff adminurl = mlist.GetScriptURL('admin', absolute=1) container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions'...
for i in range(10):
for i in range(OPTCOLUMNS):
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff adminurl = mlist.GetScriptURL('admin', absolute=1) container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions'...
for opt in ('hide', 'nomail', 'ack', 'notmetoo'):
for opt in ('hide', 'nomail', 'ack', 'notmetoo', 'nodupes'):
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff adminurl = mlist.GetScriptURL('admin', absolute=1) container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions'...
_('''<b>not metoo</b> -- Does the member avoid copies of their own posts?'''))
_('''<b>not metoo</b> -- Does the member want to avoid copies of their own postings?''')) legend.AddItem( _('''<b>nodupes</b> -- Does the member want to avoid duplicates of the same message?'''))
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff adminurl = mlist.GetScriptURL('admin', absolute=1) container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions'...
listname = self.internal_name();
def InitVars(self):
except OSError, e: if e.errno <> errno.EEXIST: raise try:
def InitVars(self):
def reset(self, score, date, noticesleft):
def reset(self, score=0, date=None, noticesleft=None): if date is None: date = ZEROHOUR_PLUSONEDAY
def reset(self, score, date, noticesleft): self.score = score self.date = date self.noticesleft = noticesleft self.lastnotice = ZEROHOUR_PLUSONEDAY
self.noticesleft = noticesleft
if noticesleft is not None: self.noticesleft = noticesleft
def reset(self, score, date, noticesleft): self.score = score self.date = date self.noticesleft = noticesleft self.lastnotice = ZEROHOUR_PLUSONEDAY
info.reset(weight, today, 0)
info.reset(noticesleft=mlist.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 =...
_nesting_level = None def GetNestingLevel(): global _nesting_level if _nesting_level == None: try: path = os.environ['PATH_INFO'] if path[0] <> '/': path= '/' + path _nesting_level = string.count(path, '/') except KeyError: _nesting_level = 0 return _nesting_level
def ScriptURL(target, web_page_url=mm_cfg.DEFAULT_URL, absolute=0): """target - scriptname only, nothing extra web_page_url - the list's configvar of the same name absolute - a flag which if set, generates an absolute url """ fullpath = os.environ.get('REQUEST_URI') if fullpath is None: fullpath = os.environ.get('SCRIP...
def GetPathPieces(path): l = string.split(path, '/') try: while 1: l.remove('') except ValueError: pass return l
self.GetMemberAdminEmail(name), self.GetAdminEmail(),
self.GetMemberAdminEmail(name), self.GetRequestEmail(),
def SendSubscribeAck(self, name, password, digest): if not self.send_welcome_msg: return
category_suffix = ''
subcat = None elif len(parts) == 2: category = parts[1] subcat = None
def main(): # Try to find out which list is being administered parts = Utils.GetPathPieces() if not parts: # None, so just do the admin overview and be done with it admin_overview() return # Get the list object listname = parts[0].lower() try: mlist = MailList.MailList(listname, lock=0) except Errors.MMListError, e: ad...
category_suffix = category
subcat = parts[2]
def main(): # Try to find out which list is being administered parts = Utils.GetPathPieces() if not parts: # None, so just do the admin overview and be done with it admin_overview() return # Get the list object listname = parts[0].lower() try: mlist = MailList.MailList(listname, lock=0) except Errors.MMListError, e: ad...
change_options(mlist, category, cgidata, doc)
change_options(mlist, category, subcat, cgidata, doc)
def sigterm_handler(signum, frame, mlist=mlist): # Make sure the list gets unlocked... mlist.Unlock() # ...and ensure we exit, otherwise race conditions could cause us to # enter MailList.Save() while we're in the unlocked state, and that # could be bad! sys.exit(0)
show_results(mlist, doc, category, category_suffix, cgidata)
show_results(mlist, doc, category, subcat, cgidata)
def sigterm_handler(signum, frame, mlist=mlist): # Make sure the list gets unlocked... mlist.Unlock() # ...and ensure we exit, otherwise race conditions could cause us to # enter MailList.Save() while we're in the unlocked state, and that # could be bad! sys.exit(0)
if len(reflist) == 2: category, varname = reflist options = mlist.GetConfigInfo()[category]
if len(reflist) >= 2: category = subcat = None if len(reflist) == 2: category, varname = reflist elif len(reflist) == 3: category, subcat, varname = reflist options = mlist.GetConfigInfo(category, subcat)
def option_help(mlist, varhelp): # The html page document doc = Document() doc.set_language(mlist.preferred_language) # Find out which category and variable help is being requested for. item = None reflist = varhelp.split('/') if len(reflist) == 2: category, varname = reflist options = mlist.GetConfigInfo()[category] f...
form = Form("%s/%s" % (mlist.GetScriptURL('admin'), category))
if subcat: url = '%s/%s/%s' % (mlist.GetScriptURL('admin'), category, subcat) else: url = '%s/%s' % (mlist.GetScriptURL('admin'), category) form = Form(url)
def option_help(mlist, varhelp): # The html page document doc = Document() doc.set_language(mlist.preferred_language) # Find out which category and variable help is being requested for. item = None reflist = varhelp.split('/') if len(reflist) == 2: category, varname = reflist options = mlist.GetConfigInfo()[category] f...
add_options_table_item(mlist, category, valtab, item, detailsp=0)
add_options_table_item(mlist, category, subcat, valtab, item, detailsp=0)
def option_help(mlist, varhelp): # The html page document doc = Document() doc.set_language(mlist.preferred_language) # Find out which category and variable help is being requested for. item = None reflist = varhelp.split('/') if len(reflist) == 2: category, varname = reflist options = mlist.GetConfigInfo()[category] f...
doc.AddItem(Link('%s/%s' % (mlist.GetScriptURL('admin'), category), _('return to the %(category)s options page.')))
adminurl = mlist.GetScriptURL('admin') if subcat: url = '%s/%s/%s' % (adminurl, category, subcat) else: url = '%s/%s' % (adminurl, category) doc.AddItem(Link(url, _('return to the %(category)s options page.')))
def option_help(mlist, varhelp): # The html page document doc = Document() doc.set_language(mlist.preferred_language) # Find out which category and variable help is being requested for. item = None reflist = varhelp.split('/') if len(reflist) == 2: category, varname = reflist options = mlist.GetConfigInfo()[category] f...
def show_results(mlist, doc, category, category_suffix, cgidata):
def show_results(mlist, doc, category, subcat, cgidata):
def show_results(mlist, doc, category, category_suffix, cgidata): # Produce the results page adminurl = mlist.GetScriptURL('admin') categories = mlist.GetConfigCategories() label = _(categories[category][0]) # Set up the document's headers realname = mlist.real_name doc.SetTitle(_('%(realname)s Administration (%(label...
if category_suffix: encoding = None if category_suffix in ('autoreply', 'members'): encoding = 'multipart/form-data' form = Form('%s/%s' % (adminurl, category_suffix), encoding=encoding)
encoding = None if category in ('autoreply', 'members'): encoding = 'multipart/form-data' if subcat: form = Form('%s/%s/%s' % (adminurl, category, subcat), encoding=encoding)
def show_results(mlist, doc, category, category_suffix, cgidata): # Produce the results page adminurl = mlist.GetScriptURL('admin') categories = mlist.GetConfigCategories() label = _(categories[category][0]) # Set up the document's headers realname = mlist.real_name doc.SetTitle(_('%(realname)s Administration (%(label...
form = Form(adminurl)
form = Form('%s/%s' % (adminurl, category), encoding=encoding)
def show_results(mlist, doc, category, category_suffix, cgidata): # Produce the results page adminurl = mlist.GetScriptURL('admin') categories = mlist.GetConfigCategories() label = _(categories[category][0]) # Set up the document's headers realname = mlist.real_name doc.SetTitle(_('%(realname)s Administration (%(label...
form.AddItem(show_variables(mlist, category, cgidata, doc))
form.AddItem(show_variables(mlist, category, subcat, cgidata, doc))
def show_results(mlist, doc, category, category_suffix, cgidata): # Produce the results page adminurl = mlist.GetScriptURL('admin') categories = mlist.GetConfigCategories() label = _(categories[category][0]) # Set up the document's headers realname = mlist.real_name doc.SetTitle(_('%(realname)s Administration (%(label...
def show_variables(mlist, category, cgidata, doc): options = mlist.GetConfigInfo()[category]
def show_variables(mlist, category, subcat, cgidata, doc): options = mlist.GetConfigInfo(category, subcat)
def show_variables(mlist, category, cgidata, doc): options = mlist.GetConfigInfo()[category] # The table containing the results table = Table(cellspacing=3, cellpadding=4, width='100%') # Get and portray the text label for the category. categories = mlist.GetConfigCategories() label = _(categories[category][0]) tabl...
add_options_table_item(mlist, category, table, item)
add_options_table_item(mlist, category, subcat, table, item)
def show_variables(mlist, category, cgidata, doc): options = mlist.GetConfigInfo()[category] # The table containing the results table = Table(cellspacing=3, cellpadding=4, width='100%') # Get and portray the text label for the category. categories = mlist.GetConfigCategories() label = _(categories[category][0]) tabl...
def add_options_table_item(mlist, category, table, item, detailsp=1):
def add_options_table_item(mlist, category, subcat, table, item, detailsp=1):
def add_options_table_item(mlist, category, table, item, detailsp=1): # Add a row to an options table with the item description and value. varname, kind, params, dependancies, descr, elaboration = \ get_item_characteristics(item) if elaboration is None: elaboration = descr descr = get_item_gui_description(mlist, catego...
descr = get_item_gui_description(mlist, category, varname, descr, detailsp)
descr = get_item_gui_description(mlist, category, subcat, varname, descr, detailsp)
def add_options_table_item(mlist, category, table, item, detailsp=1): # Add a row to an options table with the item description and value. varname, kind, params, dependancies, descr, elaboration = \ get_item_characteristics(item) if elaboration is None: elaboration = descr descr = get_item_gui_description(mlist, catego...
def get_item_gui_description(mlist, category, varname, descr, detailsp):
def get_item_gui_description(mlist, category, subcat, varname, descr, detailsp):
def get_item_gui_description(mlist, category, varname, descr, detailsp): # Return the item's description, with link to details. # # Details are not included if this is a VARHELP page, because that /is/ # the details page! if detailsp: text = Label(descr + ' ', Link(mlist.GetScriptURL('admin') + '/?VARHELP=' + category ...
text = Label(descr + ' ', Link(mlist.GetScriptURL('admin') + '/?VARHELP=' + category + '/' + varname, _('(Details)')))
if subcat: varhelp = '/?VARHELP=%s/%s/%s' % (category, subcat, varname) else: varhelp = '/?VARHELP=%s/%s' % (category, varname) link = Link(mlist.GetScriptURL('admin') + varhelp, _('<br>(Details for <b>%s</b>)' % varname)).Format() text = Label('%s %s' % (descr, link)).Format()
def get_item_gui_description(mlist, category, varname, descr, detailsp): # Return the item's description, with link to details. # # Details are not included if this is a VARHELP page, because that /is/ # the details page! if detailsp: text = Label(descr + ' ', Link(mlist.GetScriptURL('admin') + '/?VARHELP=' + category ...
text = Label(descr)
text = Label(descr).Format()
def get_item_gui_description(mlist, category, varname, descr, detailsp): # Return the item's description, with link to details. # # Details are not included if this is a VARHELP page, because that /is/ # the details page! if detailsp: text = Label(descr + ' ', Link(mlist.GetScriptURL('admin') + '/?VARHELP=' + category ...
text = text.Format() + Label(_('''<br><em><strong>Note:</strong>
text += Label(_('''<br><em><strong>Note:</strong>
def get_item_gui_description(mlist, category, varname, descr, detailsp): # Return the item's description, with link to details. # # Details are not included if this is a VARHELP page, because that /is/ # the details page! if detailsp: text = Label(descr + ' ', Link(mlist.GetScriptURL('admin') + '/?VARHELP=' + category ...
colspan=9,
colspan=10,
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions')))]) header.AddCellInfo(header.GetCurrentRowIndex(...
_('hide'), _('nomail'),
_('mod'), _('hide'), _('nomail'),
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions')))]) header.AddCellInfo(header.GetCurrentRowIndex(...
for i in range(9):
for i in range(10):
def membership_options(mlist, subcat, cgidata, doc, form): # Show the main stuff container = Container() header = Table(width="100%") # If we're in the list subcategory, show the membership list if subcat == 'add': header.AddRow([Center(Header(2, _('Mass Subscriptions')))]) header.AddCellInfo(header.GetCurrentRowIndex(...
def change_options(mlist, category, cgidata, doc):
def change_options(mlist, category, subcat, cgidata, doc):
def change_options(mlist, category, cgidata, doc): confirmed = 0 # Handle changes to the list moderator password. Do this before checking # the new admin password, since the latter will force a reauthentication. new = cgidata.getvalue('newmodpw', '').strip() confirm = cgidata.getvalue('confirmmodpw', '').strip() if ne...
if category != 'members' and \
if category <> 'members' and \
def change_options(mlist, category, cgidata, doc): confirmed = 0 # Handle changes to the list moderator password. Do this before checking # the new admin password, since the latter will force a reauthentication. new = cgidata.getvalue('newmodpw', '').strip() confirm = cgidata.getvalue('confirmmodpw', '').strip() if ne...
opt_list = mlist.GetConfigInfo()[category]
opt_list = mlist.GetConfigInfo(category, subcat)
def change_options(mlist, category, cgidata, doc): confirmed = 0 # Handle changes to the list moderator password. Do this before checking # the new admin password, since the latter will force a reauthentication. new = cgidata.getvalue('newmodpw', '').strip() confirm = cgidata.getvalue('confirmmodpw', '').strip() if ne...
of ENABLED, UNKNOWN, BYCHOICE, or BYBOUNCE. The members whose
of ENABLED, UNKNOWN, BYUSER, BYADMIN, or BYBOUNCE. The members whose
def getDeliveryStatusMembers(self, status=(UNKNOWN, BYUSER, BYADMIN, BYBOUNCE)): """Return the list of members with a matching delivery status.
MemberAdaptor.BYUNKNOWN: 'BYUNKNOWN'}.get(
MemberAdaptor.UNKNOWN: 'UNKNOWN'}.get(
def sendNextNotification(self, member): info = self.getBounceInfo(member) if info is None: return reason = self.getDeliveryStatus(member) if info.noticesleft <= 0: # BAW: Remove them now, with a notification message self.ApprovedDeleteMember( member, 'disabled address', admin_notif=self.bounce_notify_owner_on_removal, ...
url = save_attachment(mlist, part, filter_html=0)
url = save_attachment(mlist, part, dir, filter_html=0)
def process(mlist, msg, msgdata=None): sanitize = mm_cfg.ARCHIVE_HTML_SANITIZER outer = 1 for part in msg.walk(): ctype = part.get_type(part.get_default_type()) # If the part is text/plain, we leave it alone if ctype == 'text/plain': pass elif ctype == 'text/html' and isinstance(sanitize, IntType): if sanitize == 0: if...
url = save_attachment(mlist, part, filter_html=0)
url = save_attachment(mlist, part, dir, filter_html=0)
def doreplace(s): return s.replace(' ', '&nbsp;').replace('\t', '&nbsp'*8)
url = save_attachment(mlist, part)
url = save_attachment(mlist, part, dir)
def doreplace(s): return s.replace(' ', '&nbsp;').replace('\t', '&nbsp'*8)
g = Generator(mboxfp) g.flatten(msg, unixfrom=True)
mbox = Mailbox(mboxfp) mbox.AppendMessage(msg)
def process(mlist, msg, msgdata): # Short circuit non-digestable lists. if not mlist.digestable or msgdata.get('isdigest'): return mboxfile = os.path.join(mlist.fullpath(), 'digest.mbox') omask = os.umask(007) try: mboxfp = open(mboxfile, 'a+') finally: os.umask(omask) g = Generator(mboxfp) g.flatten(msg, unixfrom=True...
change_options(mlist, category, subcat, cgidata, doc)
try: change_options(mlist, category, subcat, cgidata, doc) except Errors.NotAMemberError: pass
def sigterm_handler(signum, frame, mlist=mlist): # Make sure the list gets unlocked... mlist.Unlock() # ...and ensure we exit, otherwise race conditions could cause us to # enter MailList.Save() while we're in the unlocked state, and that # could be bad! sys.exit(0)
from_lists = msg.getallmatchingheaders('x-beenthere') if self.GetListEmail() in from_lists:
beentheres = map(lambda x: string.split(x, ": ")[1][:-1], msg.getallmatchingheaders('x-beenthere')) if self.GetListEmail() in beentheres:
def Post(self, msg, approved=0):
HandlerAPI.DeliverToList(self, msg, newdata=msgdata)
HandlerAPI.DeliverToList(self, msg, msgdata)
def __handlepost(self, record, value, comment): # For backwards compatibility with pre 2.0beta3 if len(record) == 5: ptime, sender, subject, reason, filename = record msgdata = {} else: # New format of record ptime, sender, subject, reason, filename, msgdata = record path = os.path.join(mm_cfg.DATA_DIR, filename) rejec...
mlist.host_name = mm_cfg.VIRTUAL_HOSTS.get(hostname, hostname)
mlist.host_name = mm_cfg.VIRTUAL_HOSTS.get( hostname, mm_cfg.DEFAULT_EMAIL_HOST)
def sigterm_handler(signum, frame, mlist=mlist): # Make sure the list gets unlocked... mlist.Unlock() # ...and ensure we exit, otherwise race conditions could cause us to # enter MailList.Save() while we're in the unlocked state, and that # could be bad! sys.exit(0)
if newaddr == user:
if newaddr == cpuser:
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>')...
mlist.ChangeMemberAddress(user, newaddr, globally)
mlist.ChangeMemberAddress(cpuser, newaddr, globally)
def sigterm_handler(signum, frame, mlist=mlist): mlist.Unlock() sys.exit(0)
if e.errno <> EEXIST: raise
if e.errno <> errno.EEXIST: raise
def __init__(self, whichq, slice=None, numslices=1): self.__whichq = whichq # Create the directory if it doesn't yet exist. # FIXME omask = os.umask(0) # rwxrws--- try: try: os.mkdir(self.__whichq, 0770) except OSError, e: if e.errno <> EEXIST: raise finally: os.umask(omask) # Fast track for no sl...
now = `time.time()`
now = time.time()
def enqueue(self, _msg, _metadata={}, **_kws): # Calculate the SHA hexdigest of the message to get a unique base # filename. data = _metadata.copy() data.update(_kws) listname = data.get('listname', '--nolist--') now = `time.time()` msgtext = str(_msg) hashfood = msgtext + listname + now filebase = sha.new(hashfood).he...
hashfood = msgtext + listname + now filebase = sha.new(hashfood).hexdigest()
hashfood = msgtext + listname + `now` rcvtime = data.setdefault('received_time', now) filebase = `rcvtime` + '+' + sha.new(hashfood).hexdigest()
def enqueue(self, _msg, _metadata={}, **_kws): # Calculate the SHA hexdigest of the message to get a unique base # filename. data = _metadata.copy() data.update(_kws) listname = data.get('listname', '--nolist--') now = `time.time()` msgtext = str(_msg) hashfood = msgtext + listname + now filebase = sha.new(hashfood).he...
msgfp = open(msgfile) p = Parser(_class=Message.Message) msg = p.parse(msgfp) msgfp.close() os.unlink(msgfile)
msg = data = None try: msgfp = open(msgfile) except IOError, e: if e.errno <> errno.ENOENT: raise else: p = Parser(_class=Message.Message) msg = p.parse(msgfp) msgfp.close() os.unlink(msgfile)
def dequeue(self, filebase): # Calculate the .db and .msg filenames from the given filebase. msgfile = os.path.join(self.__whichq, filebase + '.msg') dbfile = os.path.join(self.__whichq, filebase + '.db') # Read the message text and parse it into a message object tree. When # done, unlink the msg file. msgfp = open(ms...
data = self._ext_read(dbfile) os.unlink(dbfile)
try: data = self._ext_read(dbfile) except (IOError, OSError), e: if e.errno <> errno.ENOENT: raise else: os.unlink(dbfile)
def dequeue(self, filebase): # Calculate the .db and .msg filenames from the given filebase. msgfile = os.path.join(self.__whichq, filebase + '.msg') dbfile = os.path.join(self.__whichq, filebase + '.db') # Read the message text and parse it into a message object tree. When # done, unlink the msg file. msgfp = open(ms...
all = [os.path.splitext(f)[0] for f in os.listdir(self.__whichq) if f.endswith('.db')] if self.__lower is None: return all return [f for f in all if self.__lower <= long(f, 16) < self.__upper]
times = {} lower = self.__lower upper = self.__upper for f in os.listdir(self.__whichq): if not f.endswith('.db'): continue filebase = os.path.splitext(f)[0] when, digest = filebase.split('+') if not lower or (lower <= long(digest, 16) < upper): times[float(when)] = filebase keys = times.keys() keys.sort() return ...
def files(self): all = [os.path.splitext(f)[0] for f in os.listdir(self.__whichq) if f.endswith('.db')] # Fast track exit if self.__lower is None: return all # BAW: test performance and end-cases of this algorithm return [f for f in all if self.__lower <= long(f, 16) < self.__upper]
data = marshal.load(fp)
dict = marshal.load(fp) for attr in self.FLOAT_ATTRIBUTES: try: sval = dict[attr] except KeyError: pass dict[attr] = eval(sval, {'__builtins__': {}})
def _ext_read(self, filename): fp = open(filename) data = marshal.load(fp) fp.close() return data
return data
return dict
def _ext_read(self, filename): fp = open(filename) data = marshal.load(fp) fp.close() return data
except codecs.LookupError:
except LookupError:
def __get_f(self): if self.__fp: return self.__fp else: try: ou = os.umask(002) try: try: f = codecs.open( self.__filename, 'a+', self.__encoding, 'replace', 1) except codecs.LookupError: f = open(self.__filename, 'a+', 1) self.__fp = f finally: os.umask(ou) except IOError, e: if self.__nofail: _logexc(self, e) f = sel...
form.AddItem('<p>') form.AddItem(Center(FormatSubmit()))
def FormatOptionHelp(doc, varref, mlist): item = None reflist = string.split(varref, '/') if len(reflist) == 2: category, varname = reflist options = GetConfigOptions(mlist, category) for i in options: if i and i[0] == varname: item = i break if not item: bad = ("Option %s/%s not found. %s" % (category, varname, os.env...
doc.AddItem("(<em><strong>Don't change the option here.</strong> " 'Use the ')
doc.AddItem("""<em><strong>Warning:</strong> changing this option here could cause other screens to be out-of-sync. Be sure to reload any other pages that are displaying this option for this mailing list. You can also """)
def FormatOptionHelp(doc, varref, mlist): item = None reflist = string.split(varref, '/') if len(reflist) == 2: category, varname = reflist options = GetConfigOptions(mlist, category) for i in options: if i and i[0] == varname: item = i break if not item: bad = ("Option %s/%s not found. %s" % (category, varname, os.env...
category + ' options page')) doc.AddItem(' instead.</em>)')
'return to the ' + category + ' options page.')) doc.AddItem('</em>') doc.AddItem(mlist.GetMailmanFooter())
def FormatOptionHelp(doc, varref, mlist): item = None reflist = string.split(varref, '/') if len(reflist) == 2: category, varname = reflist options = GetConfigOptions(mlist, category) for i in options: if i and i[0] == varname: item = i break if not item: bad = ("Option %s/%s not found. %s" % (category, varname, os.env...
if not detailsp: return '<div ALIGN="right">' + descr + '</div>' return Container('<div ALIGN="right">' + descr + ' ',
if detailsp: text = Container('<div ALIGN="right">' + descr + ' ',
def GetItemGuiDescr(mlist, category, varname, descr, detailsp): """Return the item's description, with link to details. Details are not included if this is a VARHELP page, because that /is/ the details page! """ if not detailsp: return '<div ALIGN="right">' + descr + '</div>' return Container('<div ALIGN="right">' + d...
'</div>')
'</div>').Format() else: text = '<div ALIGN="right">' + descr + '</div>' if varname[0] == '_': text = text + '''<div ALIGN="right"><br><em><strong>Note:</strong> setting this value performs an immediate action but does not modify permanent state.</em></div>''' return text
def GetItemGuiDescr(mlist, category, varname, descr, detailsp): """Return the item's description, with link to details. Details are not included if this is a VARHELP page, because that /is/ the details page! """ if not detailsp: return '<div ALIGN="right">' + descr + '</div>' return Container('<div ALIGN="right">' + d...
if len(item) < 5:
if type(item) <> types.TupleType or len(item) < 5:
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 (kind <> mm_cfg.Text and kind <> mm_cfg.String and kind <> mm_cfg.EmailList): continue else: val = ''
continue
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...
_config_info = None
def AddErrorMessage(doc, errmsg, *args): doc.AddItem(Header(3, Bold(FontAttr( 'Warning: ', color="#ff0000", size="+2")).Format() + Italic(errmsg % args).Format()))
"""Use specified old value if new value does is not in stored state.
"""Use specified old value if new value is not in stored state.
def PreferStored(oldname, newname, newdefault=uniqueval, l=l, state=stored_state): """Use specified old value if new value does is not in stored state.
if type(l.members) is type([]):
if type(l.members) is ListType:
def PreferStored(oldname, newname, newdefault=uniqueval, l=l, state=stored_state): """Use specified old value if new value does is not in stored state.
if type(l.digest_members) is type([]):
if type(l.digest_members) is ListType:
def PreferStored(oldname, newname, newdefault=uniqueval, l=l, state=stored_state): """Use specified old value if new value does is not in stored state.
if string.lower(k) != k:
if string.lower(k) <> k:
def PreferStored(oldname, newname, newdefault=uniqueval, l=l, state=stored_state): """Use specified old value if new value does is not in stored state.
pass
passwords = {} for k, v in l.passwords.items(): passwords[string.lower(k)] = v l.passwords = passwords
def UpdateOldUsers(l): """Transform sense of changed user options.""" # Currently nothing to do. pass
lock = LockFile.LockFile(LOCKFILE) lock.lock(timeout=30) try: db = _load() while 1: n = random.random() now = time.time() hashfood = str(now) + str(n) + str(content) cookie = sha.new(hashfood).hexdigest() if not db.has_key(cookie): break db[cookie] = content evictions = db.setdefault('evictions', {}) evictions[cook...
lock = LockFile.LockFile(LOCKFILE, withlogging=mm_cfg.PENDINGDB_LOCK_DEBUGGING) retries = mm_cfg.PENDINGDB_LOCK_ATTEMPTS try: while retries: retries -= 1 if not lock.locked(): try: lock.lock(timeout=mm_cfg.PENDINGDB_LOCK_TIMEOUT) except LockFile.TimeOutError: continue db = _load() while 1: n = random.random() now ...
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 = LockFile.LockFile(LOCKFILE) lock.lock(timeout=30) try:
if not expunge:
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...
if expunge:
return content lock = LockFile.LockFile(LOCKFILE, withlogging=mm_cfg.PENDINGDB_LOCK_DEBUGGING) retries = mm_cfg.PENDINGDB_LOCK_ATTEMPTS try: while retries: retries -= 1 if not lock.locked(): try: lock.lock(timeout=mm_cfg.PENDINGDB_LOCK_TIMEOUT) except LockFile.TimeOutError: continue db = _load() missing = [] cont...
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...
_save(db) return content finally: lock.unlock(unconditionally=1)
try: _save(db, lock) except LockFile.NotLockedError: continue return content else: raise LockFile.TimeOutError finally: if lock.locked(): lock.unlock()
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...
def _save(db):
def _save(db, lock): if not lock.locked(): raise LockFile.NotLockedError
def _save(db): # Lock must be acquired. evictions = db['evictions'] now = time.time() for cookie, data in db.items(): if cookie in ('evictions', 'version'): continue timestamp = evictions[cookie] if now > timestamp: # The entry is stale, so remove it. del db[cookie] del evictions[cookie] # Clean out any bogus eviction ...
tmpfile = PCKFILE + '.tmp'
tmpfile = "%s.tmp.%d.%d"%(PCKFILE, os.getpid(), now)
def _save(db): # Lock must be acquired. evictions = db['evictions'] now = time.time() for cookie, data in db.items(): if cookie in ('evictions', 'version'): continue timestamp = evictions[cookie] if now > timestamp: # The entry is stale, so remove it. del db[cookie] del evictions[cookie] # Clean out any bogus eviction ...
else: if l.posters: l.member_posting_only = 0
elif l.data_version <= 10 and l.posters: l.member_posting_only = 0
def PreferStored(oldname, newname, newdefault=uniqueval, l=l, state=stored_state): """Use specified old value if new value is not in stored state.
mcset = msg.get_param('charset', 'us-ascii')
mcset = msg.get_param('charset', 'us-ascii').lower()
def process(mlist, msg, msgdata): if msgdata.get('isdigest'): # Digests already have their own header and footer return d = {} if msgdata.get('personalize'): # Calculate the extra personalization dictionary. Note that the # length of the recips list better be exactly 1. recips = msgdata.get('recips') assert type(recip...
if not msg.is_multipart() and msgtype == 'text/plain' and mcset == lcset:
if not msg.is_multipart() and msgtype == 'text/plain' and \ (lcset == 'us-ascii' or mcset == lcset):
def process(mlist, msg, msgdata): if msgdata.get('isdigest'): # Digests already have their own header and footer return d = {} if msgdata.get('personalize'): # Calculate the extra personalization dictionary. Note that the # length of the recips list better be exactly 1. recips = msgdata.get('recips') assert type(recip...
print "\nEnsuring that all config.db files are owned by Mailman" cdbs = glob.glob(paths.prefix + '/lists/*/config.db*')
print "\nEnsuring that all config.pck files are owned by Mailman" cdbs = glob.glob(paths.prefix + '/lists/*/config.pck*')
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
replyto = []
new = []
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...
def add((name, addr)): lcaddr = addr.lower()
def add(pair): lcaddr = pair[1].lower()
def add((name, addr)): lcaddr = addr.lower() if d.has_key(lcaddr): return d[lcaddr] = (name, addr) replyto.append((name, addr))
d[lcaddr] = (name, addr) replyto.append((name, addr))
d[lcaddr] = pair new.append(pair)
def add((name, addr)): lcaddr = addr.lower() if d.has_key(lcaddr): return d[lcaddr] = (name, addr) replyto.append((name, addr))
if replyto:
if new:
def add((name, addr)): lcaddr = addr.lower() if d.has_key(lcaddr): return d[lcaddr] = (name, addr) replyto.append((name, addr))
[formataddr(pair) for pair in replyto]) if mlist.personalize and mlist.reply_goes_to_list <> 1: msg['Cc'] = formataddr((mlist.description, mlist.GetListEmail()))
[formataddr(pair) for pair in new]) if mlist.personalize and mlist.reply_goes_to_list <> 1: new = [] d = {} for pair in getaddresses(msg.get_all('cc', [])): add(pair) add((mlist.description, mlist.GetListEmail())) del msg['Cc'] msg['Cc'] = COMMASPACE.join([formataddr(pair) for pair in new])
def add((name, addr)): lcaddr = addr.lower() if d.has_key(lcaddr): return d[lcaddr] = (name, addr) replyto.append((name, addr))
syslog('vette', '%s post from %s held: %s', listname, sender, reason)
syslog('vette', '%s post from %s held, message-id=%s: %s', listname, sender, message_id, reason)
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 addrs:
if addrs: if BouncerAPI.ScanMessages(mlist, msg) is BouncerAPI.Stop: return else:
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() outq = get_switchboard(mm_cfg.OUTQUEUE_DIR) # There are a few possibilities here: # # - the message could have been VERP'd in which case, we know exactly # who the message was destined for. That make our job easy. # -...
return STOP
def process(res, args): mlist = res.mlist if len(args) <> 1: res.results.append(_('Usage:')) res.results.append(gethelp(mlist)) return STOP cookie = args[0] try: results = mlist.ProcessConfirmation(cookie, res.msg) except Errors.MMBadConfirmation, e: # Express in approximate days days = int(mm_cfg.PENDING_REQUEST_LIFE ...
<a href="?VARHELP=contentfilter/convert_html_to_plaintext"</a> is enabled and the site is configured to allow these conversions."""),
<a href="?VARHELP=contentfilter/convert_html_to_plaintext" >convert_html_to_plaintext</a> is enabled and the site is configured to allow these conversions."""),
def GetConfigInfo(self, mlist, category, subcat=None): if category <> 'contentfilter': return None WIDTH = mm_cfg.TEXTFIELDWIDTH
recipients.remove(members)
recipients.remove(sender)
def Post(self, msg, approved=0):
recipients = [] for m in members: if not self.GetUserOption(m, mm_cfg.DisableDelivery): recipients.append(m)
def Post(self, msg, approved=0):