rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if mlist.internal_name() == mm_cfg.MAILMAN_SITE_LIST:
listname = mlist.internal_name() if listname == mm_cfg.MAILMAN_SITE_LIST: foundp = 1
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. # -...
pass
syslog('bounce', "%s: couldn't get list lock", listname) return 1
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. # -...
syslog('bounce', 'bounce message with non-members: %s', COMMASPACE.join(addrs))
syslog('bounce', 'bounce message with non-members of %s: %s', listname, COMMASPACE.join(addrs))
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. # -...
mo = re.search(conf_pat, subject)
mo = re.search(conf_pat, subject, re.IGNORECASE)
def ParseMailCommands(self):
self.AddError("Subject line ignored: %s" % subject,
self.AddError('Subject line ignored:\n' + subject,
def ParseMailCommands(self):
})
}, self.preferred_language)
def AddApprovalMsg(self, cmd): text = Utils.maketext( 'approve.txt', {'requestaddr': self.GetRequestEmail(), 'cmd' : cmd, 'adminaddr' : self.GetAdminEmail(), }) self.AddError(text, trunc=0)
self.__logged = 0
self.__logged = False
def __init__(self, slice=None, numslices=1): Runner.__init__(self, slice, numslices) # Maps mailing lists to (recip, msg) tuples self._permfailures = {} self._permfail_counter = 0 # We look this function up only at startup time modname = 'Mailman.Handlers.' + mm_cfg.DELIVERY_MODULE mod = __import__(modname) self._func ...
self.__logged = 0
self.__logged = False
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() try: pid = os.getpid() self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) os._exit(1) self.__logged = 0 except ...
self.__logged = 1 return 1
self.__logged = True return True
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() try: pid = os.getpid() self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) os._exit(1) self.__logged = 0 except ...
copy = email.message_from_string(str(msg))
msgcopy = copy.deepcopy(msg)
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() try: pid = os.getpid() self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) os._exit(1) self.__logged = 0 except ...
zip(e.permfailures, [copy] * pcnt))
zip(e.permfailures, [msgcopy] * pcnt))
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() try: pid = os.getpid() self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) os._exit(1) self.__logged = 0 except ...
return 0
return False
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() try: pid = os.getpid() self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) os._exit(1) self.__logged = 0 except ...
return 1
return True
def _dispose(self, mlist, msg, msgdata): # Make sure we have the most up-to-date state mlist.Load() try: pid = os.getpid() self._func(mlist, msg, msgdata) # Failsafe -- a child may have leaked through. if pid <> os.getpid(): syslog('error', 'child process leaked thru: %s', modname) os._exit(1) self.__logged = 0 except ...
items = [] l = len(self.button_names)
items = []
def Format(self, indent=0):
range(len(self.button_names)), self.button_names, self.values): checked = (self.checked == i) items.append(RadioButton(self.name, value, checked)) items.append(name)
range(len(self.button_names)), self.button_names, self.values): ischecked = (self.checked == i) item = RadioButton(self.name, value, ischecked).Format() + name items.append(item) if not self.horizontal: t.AddRow(items) items = []
def Format(self, indent=0):
else: for item in items: t.AddRow([item])
def Format(self, indent=0):
os.makedirs(os.path.join(mm_cfg.LIST_DATA_DIR, name), 02775)
try: os.makedirs(os.path.join(mm_cfg.LIST_DATA_DIR, name), 02775) except OSError: raise Errors.MMUnknownListError
def Create(self, name, admin, crypted_password): if Utils.list_exists(name): raise Errors.MMListAlreadyExistsError, name Utils.ValidateEmail(admin) omask = os.umask(0) try: os.makedirs(os.path.join(mm_cfg.LIST_DATA_DIR, name), 02775) finally: os.umask(omask) self._full_path = os.path.join(mm_cfg.LIST_DATA_DIR, name) se...
op, data = data
op = data[0] data = data[1:]
def ProcessConfirmation(self, cookie): data = Pending.confirm(cookie) if data is None: raise Errors.MMBadConfirmation, 'data is None' try: op, data = data except ValueError: raise Errors.MMBadConfirmation, 'op-less data %s' % data if op == Pending.SUBSCRIPTION: try: addr, password, digest, lang = data except ValueError...
xlist.Lock()
unlockp = 0 if not xlist.Locked(): xlist.Lock() unlockp = 1
def __verpbounce(self, mlist, msg): bmailbox, bdomain = Utils.ParseEmail(mlist.getListAddress('bounces')) # Sadly not every MTA bounces VERP messages correctly. Fall back to # Delivered-to: and Apparently-To:, and then short-circuit if we still # don't have anything to work with. Note that there can be multiple # Del...
xlist.Unlock()
if unlockp: xlist.Unlock()
def __verpbounce(self, mlist, msg): bmailbox, bdomain = Utils.ParseEmail(mlist.getListAddress('bounces')) # Sadly not every MTA bounces VERP messages correctly. Fall back to # Delivered-to: and Apparently-To:, and then short-circuit if we still # don't have anything to work with. Note that there can be multiple # Del...
if self.subscribe_policy == 2:
elif self.subscribe_policy == 2:
def FormatSubscriptionMsg(self): msg = '' also = '' if self.subscribe_policy == 1: msg += _('''You will be sent email requesting confirmation, to prevent others from gratuitously subscribing you.''') if self.subscribe_policy == 2: msg += _("""This is a closed list, which means your subscription will be held for approva...
if self.subscribe_policy == 3:
elif self.subscribe_policy == 3:
def FormatSubscriptionMsg(self): msg = '' also = '' if self.subscribe_policy == 1: msg += _('''You will be sent email requesting confirmation, to prevent others from gratuitously subscribing you.''') if self.subscribe_policy == 2: msg += _("""This is a closed list, which means your subscription will be held for approva...
url = mlist.GetOptionsURL(addr, relative=1)
url = mlist.GetOptionsURL(addr)
def optionslinks(listname, user=user): mlist = MailList.MailList(listname, lock=0) addrs = Utils.FindMatchingAddresses(user, mlist.members, mlist.digest_members) if addrs: addr = Utils.ObscureEmail(addrs[0]) if mlist.obscure_addresses: addr = Utils.ObscureEmail(addr) url = mlist.GetOptionsURL(addr, relative=1) link = L...
print >> sys.stderr, _(__doc__) % globals()
if code: fd = sys.stderr else: fd = sys.stdout print >> fd, _(__doc__) % globals()
def usage(code, msg=''): print >> sys.stderr, _(__doc__) % globals() if msg: print >> sys.stderr, msg sys.exit(code)
print >> sys.stderr, msg
print >> fd, msg
def usage(code, msg=''): print >> sys.stderr, _(__doc__) % globals() if msg: print >> sys.stderr, msg sys.exit(code)
filename = os.path.join(self._full_path, 'extend.py')
filename = os.path.join(self.fullpath(), 'extend.py')
def __init__(self, name=None, lock=1): # No timeout by default. If you want to timeout, open the list # unlocked, then lock explicitly. # # Only one level of mixin inheritance allowed for baseclass in self.__class__.__bases__: if hasattr(baseclass, '__init__'): baseclass.__init__(self) # Initialize volatile attributes...
self._full_path = os.path.join(mm_cfg.LIST_DATA_DIR, name)
self._full_path = Site.get_listpath(name)
def InitTempVars(self, name): """Set transient variables of this and inherited classes.""" self.__lock = LockFile.LockFile( os.path.join(mm_cfg.LOCK_DIR, name or '<site>') + '.lock', # TBD: is this a good choice of lifetime? lifetime = mm_cfg.LIST_LOCK_LIFETIME, withlogging = mm_cfg.LIST_LOCK_DEBUGGING) self._internal_...
omask = os.umask(0) try: os.makedirs(os.path.join(mm_cfg.LIST_DATA_DIR, name), 02775) finally: os.umask(omask) self._full_path = os.path.join(mm_cfg.LIST_DATA_DIR, name)
def Create(self, name, admin, crypted_password, langs=None): if Utils.list_exists(name): raise Errors.MMListAlreadyExistsError, name Utils.ValidateEmail(admin) omask = os.umask(0) try: os.makedirs(os.path.join(mm_cfg.LIST_DATA_DIR, name), 02775) finally: os.umask(omask) self._full_path = os.path.join(mm_cfg.LIST_DATA_D...
fname = os.path.join(self._full_path, 'config.pck')
fname = os.path.join(self.fullpath(), 'config.pck')
def __save(self, dict): # Save the file as a binary pickle, and rotate the old version to a # backup file. We must guarantee that config.pck is always valid so # we never rotate unless the we've successfully written the temp file. # We use pickle now because marshal is not guaranteed to be compatible # between Python ...
(regex.compile('.*550 %s.*' % email_regexp), REMOVE),
(regex.compile('.*550 %s.*' % email_regexp), BOUNCE),
def ScanMessage(self, msg):
'/mailman/admin/' + list_name),
'/mailman/admindb/' + list_name),
def main(): # XXX: Yuk, blech, ick global list global form global doc global list_name doc = Document() try: path = os.environ['PATH_INFO'] except KeyError: doc.SetTitle("Admindb Error") doc.AddItem( Header(2, "You must specify what list you are intenting to visit")) print doc.Format(bgcolor="#ffffff") sys.exit(0) l...
foundp = 0
foundp = False
def check(msg): # Iterate over each message/delivery-status subpart addrs = [] for part in typed_subpart_iterator(msg, 'message', 'delivery-status'): if not part.is_multipart(): # Huh? continue # Each message/delivery-status contains a list of Message objects # which are the header blocks. Iterate over those too. for ...
foundp = 1
foundp = True
def check(msg): # Iterate over each message/delivery-status subpart addrs = [] for part in typed_subpart_iterator(msg, 'message', 'delivery-status'): if not part.is_multipart(): # Huh? continue # Each message/delivery-status contains a list of Message objects # which are the header blocks. Iterate over those too. for ...
rtnaddrs[a] = 1
rtnaddrs[a] = True
def check(msg): # Iterate over each message/delivery-status subpart addrs = [] for part in typed_subpart_iterator(msg, 'message', 'delivery-status'): if not part.is_multipart(): # Huh? continue # Each message/delivery-status contains a list of Message objects # which are the header blocks. Iterate over those too. for ...
except mm_err.MMBadPasswordError:
except Errors.MMBadPasswordError:
def isAuthenticated(list, password=None, SECRET="SECRET"): import base64, md5 if password is not None: # explicit login try: list.ConfirmAdminPassword(password) except mm_err.MMBadPasswordError: AddErrorMessage(doc, 'Error: Incorrect admin password.') return 0 except: print "Content-type: text/html\n" print "<p><h3>W...
list_info = mm_utils.GetPathPieces(path)
list_info = Utils.GetPathPieces(path)
def main(): """Process and produce list options form. CGI input indicates that we're returning from submission of some new settings, which is processed before producing the new version.""" global list_name, list_info, doc doc = Document() try: path = os.environ['PATH_INFO'] except KeyError: path = "" list_info = mm_u...
lst = maillist.MailList(list_name) except mm_err.MMUnknownListError:
lst = MailList.MailList(list_name) except Errors.MMUnknownListError:
def main(): """Process and produce list options form. CGI input indicates that we're returning from submission of some new settings, which is processed before producing the new version.""" global list_name, list_info, doc doc = Document() try: path = os.environ['PATH_INFO'] except KeyError: path = "" list_info = mm_u...
print LOGIN_PAGE % ({"listname": list_name, "path": os.environ.get("REQUEST_URI", "/mailman/admin"), "message": message})
text = Utils.maketext( 'admlogin.txt', {"listname": list_name, "path" : os.environ.get("REQUEST_URI", "/mailman/admin"), "message" : message, }) print text
def main(): """Process and produce list options form. CGI input indicates that we're returning from submission of some new settings, which is processed before producing the new version.""" global list_name, list_info, doc doc = Document() try: path = os.environ['PATH_INFO'] except KeyError: path = "" list_info = mm_u...
except mm_err.MMBadConfigError, line:
except Errors.MMBadConfigError, line:
def main(): """Process and produce list options form. CGI input indicates that we're returning from submission of some new settings, which is processed before producing the new version.""" global list_name, list_info, doc doc = Document() try: path = os.environ['PATH_INFO'] except KeyError: path = "" list_info = mm_u...
legend = "%s maillists - Admin Links" % mm_cfg.DEFAULT_HOST_NAME
legend = "%s mailing lists - Admin Links" % mm_cfg.DEFAULT_HOST_NAME
def FormatAdminOverview(error=None): "Present a general welcome and itemize the (public) lists." doc = Document() legend = "%s maillists - 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.GetCurrentR...
names = mm_utils.list_names()
names = Utils.list_names()
def FormatAdminOverview(error=None): "Present a general welcome and itemize the (public) lists." doc = Document() legend = "%s maillists - 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.GetCurrentR...
l = maillist.MailList(n, lock=0)
l = MailList.MailList(n, lock=0)
def FormatAdminOverview(error=None): "Present a general welcome and itemize the (public) lists." doc = Document() legend = "%s maillists - 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.GetCurrentR...
" maillists on %s." % mm_cfg.DEFAULT_HOST_NAME,
" mailing lists on %s." % mm_cfg.DEFAULT_HOST_NAME,
def FormatAdminOverview(error=None): "Present a general welcome and itemize the (public) lists." doc = Document() legend = "%s maillists - 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.GetCurrentR...
Link(os.path.join('../'* mm_utils.GetNestingLevel(), "listinfo/"), "the maillist overview page"),
Link(os.path.join('../'* Utils.GetNestingLevel(), "listinfo/"), "the mailing list overview page"),
def FormatAdminOverview(error=None): "Present a general welcome and itemize the (public) lists." doc = Document() legend = "%s maillists - 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.GetCurrentR...
doc.AddItem(Center(Header(2, ('%s Maillist Configuration - %s Section'
doc.AddItem(Center(Header(2, ('%s Mailing list Configuration - %s Section'
def FormatConfiguration(doc, lst, category, category_suffix): """Produce the overall doc, *except* any processing error messages.""" for k, v in CATEGORIES: if k == category: label = v doc.SetTitle('%s Administration' % lst.real_name) doc.AddItem(Center(Header(2, ('%s Maillist Configuration - %s Section' % (lst.real_n...
legend = ('%s Maillist Configuration Help<br><em>%s</em> Option'
legend = ('%s Mailing list Configuration Help<br><em>%s</em> Option'
def FormatOptionHelp(doc, varref, lst): item = bad = None reflist = string.split(varref, '/') if len(reflist) == 2: category, varname = reflist options = GetConfigOptions(lst, 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.e...
ref = "../" * (mm_utils.GetNestingLevel()-1) + list_name + "/"
ref = "../" * (Utils.GetNestingLevel()-1) + list_name + "/"
def GetItemGuiDescr(lst, category, varname, descr, elaboration, nodetails): """Return a representation of an item's description, with link to elaboration if any.""" descr = '<div ALIGN="right">' + descr if not nodetails and elaboration: ref = "../" * (mm_utils.GetNestingLevel()-1) + list_name + "/" ref = ref + '?VARHEL...
chunks = mm_utils.chunkify(all)
chunks = Utils.chunkify(all)
def FormatMembershipOptions(lst): container = Container() header = Table(width="100%") header.AddRow([Center(Header(2, "Membership Management"))]) header.AddCellInfo(max(header.GetCurrentRowIndex(), 0), 0, colspan=2, bgcolor="#99ccff") container.AddItem(header) user_table = Table(width="90%") user_table.AddRow([Center(...
if lst.GetUserOption(member, mm_mailcmd.option_info[opt]):
if lst.GetUserOption(member, MailCommandHandler.option_info[opt]):
def FormatMembershipOptions(lst): container = Container() header = Table(width="100%") header.AddRow([Center(Header(2, "Membership Management"))]) header.AddCellInfo(max(header.GetCurrentRowIndex(), 0), 0, colspan=2, bgcolor="#99ccff") container.AddItem(header) user_table = Table(width="90%") user_table.AddRow([Center(...
valid = mm_utils.ValidEmail(val)
valid = Utils.ValidEmail(val)
def GetValidValue(lst, prop, my_type, val, dependant): if my_type == mm_cfg.Radio or my_type == mm_cfg.Toggle: if type(val) <> types.IntType: try: # XXX Security!? val = eval(val) except: pass # Don't know what to do here... return val elif my_type == mm_cfg.String or my_type == mm_cfg.Text: return val elif my_type == ...
import mm_utils
def SafeValidAddr(addr): import mm_utils try: valid = mm_utils.ValidEmail(addr) if valid: return 1 else: return 0 except: return 0
valid = mm_utils.ValidEmail(addr)
valid = Utils.ValidEmail(addr)
def SafeValidAddr(addr): import mm_utils try: valid = mm_utils.ValidEmail(addr) if valid: return 1 else: return 0 except: return 0
except mm_err.MMBadPasswordError:
except Errors.MMBadPasswordError:
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
lst.password = crypt.crypt(new, mm_utils.GetRandomSeed())
lst.password = crypt(new, Utils.GetRandomSeed())
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
lst.ApprovedAddMember(new_name, (mm_utils.GetRandomSeed() + mm_utils.GetRandomSeed()), digest)
lst.ApprovedAddMember(new_name, (Utils.GetRandomSeed() + Utils.GetRandomSeed()), digest)
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
except mm_err.MMAlreadyAMember:
except Errors.MMAlreadyAMember:
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
except mm_err.MMBadEmailError:
except Errors.MMBadEmailError:
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
except mm_err.MMHostileAddress:
except Errors.MMHostileAddress:
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
lst.SetUserOption(user, mm_mailcmd.option_info[opt], 1)
lst.SetUserOption(user, MailCommandHandler.option_info[opt], 1)
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
lst.SetUserOption(user, mm_mailcmd.option_info[opt], 0)
lst.SetUserOption(user, MailCommandHandler.option_info[opt], 0)
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 mm_err.MMBadPasswordError: m = "Error: incorrect administrator passw...
_rx_quote = re.compile('=([A-Z0-9][A-Z0-9])')
_rx_quote = re.compile('=([A-F0-9][A-F0-9])')
def _get_next(self): """Return the href and subject for the previous message"""
'non-existent list: %s\n' % listname)
'non-existent list: %s' % listname)
def main(): """Process and produce list options form. CGI input indicates that we're returning from submission of some new settings, which is processed before producing the new version. """ doc = Document() try: path = os.environ['PATH_INFO'] except KeyError: path = '' parts = Utils.GetPathPieces(path) # How many ../...
if id == IGN:
if type == IGN:
def __opendb(self): filename = self.__filename() if self.__db is None: assert self.Locked() try: fp = open(filename) self.__db = marshal.load(fp) fp.close() except IOError, e: if e.errno <> errno.ENOENT: raise self.__db = {} except EOFError, e: # The unmarshalling failed, which means the file is corrupt. # Sigh. Start ...
elif id == HELDMSG and len(data) == 5:
elif type == HELDMSG and len(data) == 5:
def __opendb(self): filename = self.__filename() if self.__db is None: assert self.Locked() try: fp = open(filename) self.__db = marshal.load(fp) fp.close() except IOError, e: if e.errno <> errno.ENOENT: raise self.__db = {} except EOFError, e: # The unmarshalling failed, which means the file is corrupt. # Sigh. Start ...
elif id == SUBSCRIPTION and len(data) == 5: stime, addr, password, digest, lang = data self.__db[id] = stime, addr, '', password, digest, lang
elif type == SUBSCRIPTION: if len(data) == 4: stime, addr, password, digest = data lang = self.preferred_language data = stime, addr, '', password, digest, lang elif len(data) == 5: stime, addr, password, digest, lang = data data = stime, addr, '', password, digest, lang self.__db[id] = type, data
def __opendb(self): filename = self.__filename() if self.__db is None: assert self.Locked() try: fp = open(filename) self.__db = marshal.load(fp) fp.close() except IOError, e: if e.errno <> errno.ENOENT: raise self.__db = {} except EOFError, e: # The unmarshalling failed, which means the file is corrupt. # Sigh. Start ...
except (TypeError, ValueError):
except (TypeError, ValueError), e:
def maketext(templatefile, dict=None, raw=0, lang=None, mlist=None): # Make some text from a template file. The order of searches depends on # whether mlist and lang are provided. Once the templatefile is found, # string substitution is performed by interpolation in `dict'. If `raw' # is false, the resulting text is...
if not d.has_key('_mlist'): self._mlist = None
listname = d.get('__listname') if listname: del d['__listname'] d['_mlist'] = self._open_list(listname)
def __setstate__(self, d): # For loading older Articles via pickle. All this stuff was added # when Simone Piunni and Tokio Kikuchi i18n'ified Pipermail. See SF # patch #594771. self.__dict__ = d if not d.has_key('_mlist'): self._mlist = None if not d.has_key('_lang'): if self._mlist is None: self._lang = mm_cfg.DEFA...
return Utils.maketext(
return quick_maketext(
def as_html(self): d = self.__dict__.copy()
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
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
return Utils.maketext(
return quick_maketext(
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), "...
return Utils.maketext(
return quick_maketext(
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),...
d["archive_listing_start"] = Utils.maketext(
d["archive_listing_start"] = quick_maketext(
def html_TOC(self): mlist = self.maillist listname = mlist.internal_name() mbox = os.path.join(mlist.archive_dir()+'.mbox', listname+'.mbox') d = {"listname": mlist.real_name, "listinfo": mlist.GetScriptURL('listinfo', absolute=1), "fullarch": '../%s.mbox/%s.mbox' % (listname, listname), "size": sizeof(mbox, mlist.pref...
d["archive_listing_end"] = Utils.maketext(
d["archive_listing_end"] = quick_maketext(
def html_TOC(self): mlist = self.maillist listname = mlist.internal_name() mbox = os.path.join(mlist.archive_dir()+'.mbox', listname+'.mbox') d = {"listname": mlist.real_name, "listinfo": mlist.GetScriptURL('listinfo', absolute=1), "fullarch": '../%s.mbox/%s.mbox' % (listname, listname), "size": sizeof(mbox, mlist.pref...
return Utils.maketext(
return quick_maketext(
def html_TOC(self): mlist = self.maillist listname = mlist.internal_name() mbox = os.path.join(mlist.archive_dir()+'.mbox', listname+'.mbox') d = {"listname": mlist.real_name, "listinfo": mlist.GetScriptURL('listinfo', absolute=1), "fullarch": '../%s.mbox/%s.mbox' % (listname, listname), "size": sizeof(mbox, mlist.pref...
return Utils.maketext(
return quick_maketext(
def html_TOC_entry(self, arch): # Check to see if the archive is gzip'd or not txtfile = os.path.join(self.maillist.archive_dir(), arch + '.txt') gzfile = txtfile + '.gz' # which exists? .txt.gz first, then .txt if os.path.exists(gzfile): file = gzfile url = arch + '.txt.gz' templ = '<td><A href="%(url)s">[ ' + _('Gzi...
print Utils.maketext(
print quick_maketext(
def write_index_entry(self, article): subject = self.get_header("subject", article) author = self.get_header("author", article) subject = CGIescape(subject) author = CGIescape(author)
if article.subject in ['subscribe', 'unsubscribe']: return None
def get_archives(self, article):
mylist = getattr(mlist, '_mlist', None) if mlist is None:
if getattr(self, '_mlist', None) is None:
def setListIfUnset(self, mlist): mylist = getattr(mlist, '_mlist', None) if mlist is None: self._mlist = mlist
def encode_p(mlist, subject, prefix): if mlist.encode_ascii_prefixes == 1: return 1 try: prefix.encode('us-ascii') except UnicodeError: return 1 if mlist.encode_ascii_prefixes == 0: return 0 try: str(subject).encode('us-ascii') except UnicodeError: return 1 return 0
def encode_p(mlist, subject, prefix): # Decide whether we're going to encode the prefix or not if mlist.encode_ascii_prefixes == 1: # Always encode return 1 try: prefix.encode('us-ascii') except UnicodeError: # There are non-ASCII characters in the prefix, so we must encode it return 1 if mlist.encode_ascii_prefixes ==...
subpart = email.Iterators.typed_subpart_iterator( context, 'text', 'plain')[0]
subpart = list(email.Iterators.typed_subpart_iterator( context, 'text', 'plain'))[0]
def ProcessConfirmation(self, cookie, context=None): data = Pending.confirm(cookie) if data is None: raise Errors.MMBadConfirmation, 'data is None' try: op = data[0] data = data[1:] except ValueError: raise Errors.MMBadConfirmation, 'op-less data %s' % (data,) if op == Pending.SUBSCRIPTION: try: userdesc = data[0] # BA...
cset = Utils.GetCharSet(self.preferred_language)
cset = i18n.get_translation().charset() or \ Utils.GetCharSet(self.preferred_language)
def GetConfirmJoinSubject(self, listname, cookie): if mm_cfg.VERP_CONFIRMATIONS and cookie: cset = Utils.GetCharSet(self.preferred_language) subj = Header( _('Your confirmation is required to join the %(listname)s mailing list'), cset, header_name='subject') return subj else: return 'confirm ' + cookie
cset = Utils.GetCharSet(self.preferred_language)
cset = i18n.get_translation().charset() or \ Utils.GetCharSet(self.preferred_language)
def GetConfirmLeaveSubject(self, listname, cookie): if mm_cfg.VERP_CONFIRMATIONS and cookie: cset = Utils.GetCharSet(self.preferred_language) subj = Header( _('Your confirmation is required to leave the %(listname)s mailing list'), cset, header_name='subject') return subj else: return 'confirm ' + cookie
From %(email)s %(datestr)s
From %(email)s %(fromdate)s
def url_quote(s): return urllib.quote(s)
<li>If y<i>member_posting_only</i> is 'yes', then entries
<li>If <i>member_posting_only</i> is 'yes', then entries
def GetConfigInfo(self): config_info = {} config_info['digest'] = Digester.GetConfigInfo(self) config_info['archive'] = Archiver.GetConfigInfo(self) config_info['gateway'] = GatewayManager.GetConfigInfo(self) config_info['autoreply'] = Autoresponder.GetConfigInfo(self)
def InitTempVars(self):
def InitVars(self):
def InitTempVars(self): if self._internal_name: self._template_dir = os.path.join(mm_cfg.TEMPLATE_DIR, self._internal_name) else: self._template_dir = mm_cfg.TEMPLATE_DIR
self._template_dir = os.path.join(mm_cfg.TEMPLATE_DIR,
self._template_dir = os.path.join(mm_cfg.LIST_DATA_DIR,
def InitTempVars(self): if self._internal_name: self._template_dir = os.path.join(mm_cfg.TEMPLATE_DIR, self._internal_name) else: self._template_dir = mm_cfg.TEMPLATE_DIR
HTMLFormatter.InitTempVars(self)
HTMLFormatter.InitVars(self)
def SnarfHTMLTemplate(self, file): # XXX: hack, blech, yuk HTMLFormatter.InitTempVars(self)
key += 'user+%s' % user
key += 'user+%s' % Utils.ObscureEmail(user)
def AuthContextInfo(self, authcontext, user=None): # authcontext may be one of AuthUser, AuthListModerator, # AuthListAdmin, AuthSiteAdmin. Not supported is the AuthCreator # context. # # user is ignored unless authcontext is AuthUser # # Return the authcontext's secret and cookie key. If the authcontext # doesn't ex...
except Errors.MMNotAMemberError:
except Errors.NotAMemberError:
def WebAuthenticate(self, authcontexts, response, user=None): # Given a list of authentication contexts, check to see if the cookie # contains a matching authorization, falling back to checking whether # the response matches one of the passwords. authcontexts must be a # sequence, and if it contains the context AuthUs...
raise Errors.MMBadUserError
raise ValueError
def MakeCookie(self, authcontext, user=None): key, secret = self.AuthContextInfo(authcontext, user) if key is None or secret is None or not isinstance(secret, StringType): raise Errors.MMBadUserError # Timestamp issued = int(time.time()) # Get a digest of the secret, plus other information. mac = sha.new(secret + `issu...
prefix = self.internal_name() + ':user:'
prefix = self.internal_name() + '+user+'
def CheckCookie(self, authcontext, user=None): # Two results can occur: we return 1 meaning the cookie authentication # succeeded for the authorization context, we return 0 meaning the # authentication failed. # # Dig out the cookie data, which better be passed on this cgi # environment variable. If there's no cookie ...
for user in usernames:
for user in [Utils.UnobscureEmail(u) for u in usernames]:
def CheckCookie(self, authcontext, user=None): # Two results can occur: we return 1 meaning the cookie authentication # succeeded for the authorization context, we return 0 meaning the # authentication failed. # # Dig out the cookie data, which better be passed on this cgi # environment variable. If there's no cookie ...
kws.setdefault('alink', mm_cfg.WEB_LINK_COLOR)
kws.setdefault('link', mm_cfg.WEB_LINK_COLOR)
def Format(self, indent=0, **kws): charset = 'us-ascii' if self.language: charset = Utils.GetCharSet(self.language) output = ['Content-Type: text/html; charset=%s\n' % charset] if not self.suppress_head: kws.setdefault('bgcolor', self.bgcolor) tab = ' ' * indent output.extend([tab, '<HTML>', '<HEAD>' ]) if mm_cfg.IMAGE...
sender = self.FindUser(mail.GetSender()) self.ConfirmUserPassword(sender, args[2])
def ShowSetUsage(s=self, od = option_descs): options = od.keys() options.sort() s.AddError("Usage: set <option> <on|off> <password>") s.AddError("Valid options are:") for option in options: s.AddError("%s: %s" % (option, od[option]))
except Errors.MMNotAMemberError: self.AddError("%s isn't subscribed to this list." % mail.GetSender())
def ShowSetUsage(s=self, od = option_descs): options = od.keys() options.sort() s.AddError("Usage: set <option> <on|off> <password>") s.AddError("Valid options are:") for option in options: s.AddError("%s: %s" % (option, od[option]))
except Errors.MMBadPasswordError: self.AddError("You gave the wrong password.")
def ShowSetUsage(s=self, od = option_descs): options = od.keys() options.sort() s.AddError("Usage: set <option> <on|off> <password>") s.AddError("Valid options are:") for option in options: s.AddError("%s: %s" % (option, od[option]))
sender = self.FindUser(mail.GetSender()) if not sender: self.AddError("You aren't subscribed.") return self.ConfirmUserPassword(sender, args[2])
def ShowSetUsage(s=self, od = option_descs): options = od.keys() options.sort() s.AddError("Usage: set <option> <on|off> <password>") s.AddError("Valid options are:") for option in options: s.AddError("%s: %s" % (option, od[option]))
Link("%slistinfo%s" % ('../' * Utils.GetNestingLevel(), mm_cfg.CGIEXT), "the mailing list overview page"),
Link(Utils.ScriptURL('listinfo'), 'the mailing list overview page'),
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...
[Link(l.GetRelativeScriptURL('admin'), Bold(l.real_name)), l.description or Italic('[no description available]')])
[Link(l.GetScriptURL('admin'), Bold(l.real_name)), l.description or Italic('[no description available]'), ])
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...
adminurl = mlist.GetRelativeScriptURL('admin')
adminurl = mlist.GetScriptURL('admin')
def FormatConfiguration(doc, mlist, category, category_suffix, cgi_data): """Produce the overall doc, *except* any processing error messages.""" for k, v in CATEGORIES: if k == category: label = v doc.SetTitle('%s Administration (%s)' % (mlist.real_name, label)) doc.AddItem(Center(Header(2, '%s mailing list administra...