------------------------------------------------------------ revno: 1806 committer: Mark Sapiro <m...@msapiro.net> branch nick: 2.1 timestamp: Mon 2019-01-28 21:48:13 -0800 message: Expand tabs in Python code. modified: Mailman/Digester.py Mailman/Gui/Archive.py Mailman/Gui/Digest.py Mailman/LockFile.py Mailman/Logging/StampedLogger.py Mailman/MailList.py Mailman/Message.py Mailman/Utils.py contrib/courier-to-mailman.py contrib/rotatelogs.py
-- lp:mailman/2.1 https://code.launchpad.net/~mailman-coders/mailman/2.1 Your team Mailman Checkins is subscribed to branch lp:mailman/2.1. To unsubscribe from this branch go to https://code.launchpad.net/~mailman-coders/mailman/2.1/+edit-subscription
=== modified file 'Mailman/Digester.py' --- Mailman/Digester.py 2018-06-17 23:47:34 +0000 +++ Mailman/Digester.py 2019-01-29 05:48:13 +0000 @@ -31,20 +31,20 @@ class Digester: def InitVars(self): - # Configurable - self.digestable = mm_cfg.DEFAULT_DIGESTABLE - self.digest_is_default = mm_cfg.DEFAULT_DIGEST_IS_DEFAULT - self.mime_is_default_digest = mm_cfg.DEFAULT_MIME_IS_DEFAULT_DIGEST - self.digest_size_threshhold = mm_cfg.DEFAULT_DIGEST_SIZE_THRESHHOLD - self.digest_send_periodic = mm_cfg.DEFAULT_DIGEST_SEND_PERIODIC - self.next_post_number = 1 - self.digest_header = mm_cfg.DEFAULT_DIGEST_HEADER - self.digest_footer = mm_cfg.DEFAULT_DIGEST_FOOTER + # Configurable + self.digestable = mm_cfg.DEFAULT_DIGESTABLE + self.digest_is_default = mm_cfg.DEFAULT_DIGEST_IS_DEFAULT + self.mime_is_default_digest = mm_cfg.DEFAULT_MIME_IS_DEFAULT_DIGEST + self.digest_size_threshhold = mm_cfg.DEFAULT_DIGEST_SIZE_THRESHHOLD + self.digest_send_periodic = mm_cfg.DEFAULT_DIGEST_SEND_PERIODIC + self.next_post_number = 1 + self.digest_header = mm_cfg.DEFAULT_DIGEST_HEADER + self.digest_footer = mm_cfg.DEFAULT_DIGEST_FOOTER self.digest_volume_frequency = mm_cfg.DEFAULT_DIGEST_VOLUME_FREQUENCY - # Non-configurable. + # Non-configurable. self.one_last_digest = {} - self.digest_members = {} - self.next_digest_number = 1 + self.digest_members = {} + self.next_digest_number = 1 self.digest_last_sent_at = 0 def send_digest_now(self): === modified file 'Mailman/Gui/Archive.py' --- Mailman/Gui/Archive.py 2018-06-17 23:47:34 +0000 +++ Mailman/Gui/Archive.py 2019-01-29 05:48:13 +0000 @@ -27,18 +27,18 @@ def GetConfigInfo(self, mlist, category, subcat=None): if category <> 'archive': return None - return [ + return [ _("List traffic archival policies."), - ('archive', mm_cfg.Toggle, (_('No'), _('Yes')), 0, - _('Archive messages?')), + ('archive', mm_cfg.Toggle, (_('No'), _('Yes')), 0, + _('Archive messages?')), - ('archive_private', mm_cfg.Radio, (_('public'), _('private')), 0, + ('archive_private', mm_cfg.Radio, (_('public'), _('private')), 0, _('Is archive file source for public or private archival?')), - ('archive_volume_frequency', mm_cfg.Radio, + ('archive_volume_frequency', mm_cfg.Radio, (_('Yearly'), _('Monthly'), _('Quarterly'), _('Weekly'), _('Daily')), 0, - _('How often should a new archive volume be started?')), - ] + _('How often should a new archive volume be started?')), + ] === modified file 'Mailman/Gui/Digest.py' --- Mailman/Gui/Digest.py 2018-06-17 23:47:34 +0000 +++ Mailman/Gui/Digest.py 2019-01-29 05:48:13 +0000 @@ -40,37 +40,37 @@ return None WIDTH = mm_cfg.TEXTFIELDWIDTH - info = [ + info = [ _("Batched-delivery digest characteristics."), - ('digestable', mm_cfg.Toggle, (_('No'), _('Yes')), 1, - _('Can list members choose to receive list traffic ' - 'bunched in digests?')), - - ('digest_is_default', mm_cfg.Radio, - (_('Regular'), _('Digest')), 0, - _('Which delivery mode is the default for new users?')), - - ('mime_is_default_digest', mm_cfg.Radio, - (_('Plain'), _('MIME')), 0, - _('When receiving digests, which format is default?')), - - ('digest_size_threshhold', mm_cfg.Number, 3, 0, - _('How big in Kb should a digest be before it gets sent out?' + ('digestable', mm_cfg.Toggle, (_('No'), _('Yes')), 1, + _('Can list members choose to receive list traffic ' + 'bunched in digests?')), + + ('digest_is_default', mm_cfg.Radio, + (_('Regular'), _('Digest')), 0, + _('Which delivery mode is the default for new users?')), + + ('mime_is_default_digest', mm_cfg.Radio, + (_('Plain'), _('MIME')), 0, + _('When receiving digests, which format is default?')), + + ('digest_size_threshhold', mm_cfg.Number, 3, 0, + _('How big in Kb should a digest be before it gets sent out?' ' 0 implies no maximum size.')), - ('digest_send_periodic', mm_cfg.Radio, (_('No'), _('Yes')), 1, - _('Should a digest be dispatched daily when the size threshold ' - "isn't reached?")), + ('digest_send_periodic', mm_cfg.Radio, (_('No'), _('Yes')), 1, + _('Should a digest be dispatched daily when the size threshold ' + "isn't reached?")), ('digest_header', mm_cfg.Text, (4, WIDTH), 0, - _('Header added to every digest'), + _('Header added to every digest'), _("Text attached (as an initial message, before the table" " of contents) to the top of digests. ") + Utils.maketext('headfoot.html', raw=1, mlist=mlist)), - ('digest_footer', mm_cfg.Text, (4, WIDTH), 0, - _('Footer added to every digest'), + ('digest_footer', mm_cfg.Text, (4, WIDTH), 0, + _('Footer added to every digest'), _("Text attached (as a final message) to the bottom of digests. ") + Utils.maketext('headfoot.html', raw=1, mlist=mlist)), @@ -89,7 +89,7 @@ ('_send_digest_now', mm_cfg.Toggle, (_('No'), _('Yes')), 0, _('''Should Mailman send the next digest right now, if it is not empty?''')), - ] + ] ## if mm_cfg.OWNERS_CAN_ENABLE_PERSONALIZATION: ## info.extend([ === modified file 'Mailman/LockFile.py' --- Mailman/LockFile.py 2018-06-17 23:47:34 +0000 +++ Mailman/LockFile.py 2019-01-29 05:48:13 +0000 @@ -195,7 +195,7 @@ self.__logprefix = os.path.split(self.__lockfile)[1] # For transferring ownership across a fork. self.__owned = True - + def __repr__(self): return '<LockFile %s: %s [%s: %ssec] pid=%s>' % ( id(self), self.__lockfile, === modified file 'Mailman/Logging/StampedLogger.py' --- Mailman/Logging/StampedLogger.py 2018-06-17 23:47:34 +0000 +++ Mailman/Logging/StampedLogger.py 2019-01-29 05:48:13 +0000 @@ -42,14 +42,14 @@ """ def __init__(self, category, label=None, manual_reprime=0, nofail=1, immediate=1): - """If specified, optional label is included after timestamp. + """If specified, optional label is included after timestamp. Other options are passed to the Logger class initializer. """ - self.__label = label + self.__label = label self.__manual_reprime = manual_reprime self.__primed = 1 self.__bol = 1 - Logger.__init__(self, category, nofail, immediate) + Logger.__init__(self, category, nofail, immediate) def reprime(self): """Reset so timestamp will be included with next write.""" @@ -77,13 +77,13 @@ self.__bol = 0 def writelines(self, lines): - first = 1 - for l in lines: - if first: - self.write(l) - first = 0 - else: - if l and l[0] not in [' ', '\t', '\n']: - Logger.write(self, ' ' + l) - else: - Logger.write(self, l) + first = 1 + for l in lines: + if first: + self.write(l) + first = 0 + else: + if l and l[0] not in [' ', '\t', '\n']: + Logger.write(self, ' ' + l) + else: + Logger.write(self, l) === modified file 'Mailman/MailList.py' --- Mailman/MailList.py 2018-11-30 22:53:02 +0000 +++ Mailman/MailList.py 2019-01-29 05:48:13 +0000 @@ -424,7 +424,7 @@ self.dmarc_none_moderation_action = ( mm_cfg.DEFAULT_DMARC_NONE_MODERATION_ACTION) self.dmarc_moderation_notice = '' - self.dmarc_moderation_addresses = [] + self.dmarc_moderation_addresses = [] self.dmarc_wrapped_message_text = ( mm_cfg.DEFAULT_DMARC_WRAPPED_MESSAGE_TEXT) self.equivalent_domains = ( === modified file 'Mailman/Message.py' --- Mailman/Message.py 2018-06-17 23:47:34 +0000 +++ Mailman/Message.py 2019-01-29 05:48:13 +0000 @@ -236,7 +236,7 @@ Mailman.Message.Generator. Operates like email.Message.Message.as_string, only - using Mailman's Message.Generator class. Only the top headers will + using Mailman's Message.Generator class. Only the top headers will get folded. """ fp = StringIO() === modified file 'Mailman/Utils.py' --- Mailman/Utils.py 2018-07-24 21:56:35 +0000 +++ Mailman/Utils.py 2019-01-29 05:48:13 +0000 @@ -1529,7 +1529,7 @@ ptr = ipaddress.ip_address(uip).reverse_pointer except ValueError: return False - lookup = '{0}.zen.spamhaus.org'.format('.'.join(ptr.split('.')[:-2])) + lookup = '{0}.zen.spamhaus.org'.format('.'.join(ptr.split('.')[:-2])) else: parts = ip.split('.') if len(parts) != 4: === modified file 'contrib/courier-to-mailman.py' --- contrib/courier-to-mailman.py 2009-02-06 20:05:16 +0000 +++ contrib/courier-to-mailman.py 2019-01-29 05:48:13 +0000 @@ -57,69 +57,69 @@ import sys, os, re, string def main(): - os.nice(5) # Handle mailing lists at non-interactive priority. - - os.chdir(MailmanVar + "/lists") - - try: - local = string.lower(os.environ["LOCAL"]) - except: - # This might happen if we're not using qmail. - sys.stderr.write("LOCAL not set in environment?\n") - sys.exit(112) - - names = ("root", "postmaster", "mailer-daemon", "mailman-owner", "owner", - "abuse") - for i in names: - if i == local: - os.execv("/usr/bin/sendmail", - ("/usr/bin/sendmail", MailmanOwner)) - sys.exit(0) - - type = "post" - listname = string.lower(local) - types = (("-admin$", "admin"), - ("-bounces$", "bounces"), - ("-bounces\+.*$", "bounces"), # for VERP - ("-confirm$", "confirm"), - ("-confirm\+.*$", "confirm"), - ("-join$", "join"), - ("-leave$", "leave"), - ("-owner$", "owner"), - ("-request$", "request"), - ("-subscribe$", "subscribe"), - ("-unsubscribe$", "unsubscribe")) - - for i in types: - if re.search(i[0],local): - type = i[1] - listname = re.sub(i[0],"",local) - - if os.path.exists(listname): - os.execv(MailmanHome + "/mail/mailman", - (MailmanHome + "/mail/mailman", type, listname)) - else: - bounce() - - sys.exit(111) + os.nice(5) # Handle mailing lists at non-interactive priority. + + os.chdir(MailmanVar + "/lists") + + try: + local = string.lower(os.environ["LOCAL"]) + except: + # This might happen if we're not using qmail. + sys.stderr.write("LOCAL not set in environment?\n") + sys.exit(112) + + names = ("root", "postmaster", "mailer-daemon", "mailman-owner", "owner", + "abuse") + for i in names: + if i == local: + os.execv("/usr/bin/sendmail", + ("/usr/bin/sendmail", MailmanOwner)) + sys.exit(0) + + type = "post" + listname = string.lower(local) + types = (("-admin$", "admin"), + ("-bounces$", "bounces"), + ("-bounces\+.*$", "bounces"), # for VERP + ("-confirm$", "confirm"), + ("-confirm\+.*$", "confirm"), + ("-join$", "join"), + ("-leave$", "leave"), + ("-owner$", "owner"), + ("-request$", "request"), + ("-subscribe$", "subscribe"), + ("-unsubscribe$", "unsubscribe")) + + for i in types: + if re.search(i[0],local): + type = i[1] + listname = re.sub(i[0],"",local) + + if os.path.exists(listname): + os.execv(MailmanHome + "/mail/mailman", + (MailmanHome + "/mail/mailman", type, listname)) + else: + bounce() + + sys.exit(111) def bounce(): - bounce_message = """\ + bounce_message = """\ TO ACCESS THE MAILING LIST SYSTEM: Start your web browser on http://%s/ That web page will help you subscribe or unsubscribe, and will give you directions on how to post to each mailing list.\n""" - sys.stderr.write(bounce_message % (os.environ["HOST"])) - sys.exit(100) + sys.stderr.write(bounce_message % (os.environ["HOST"])) + sys.exit(100) try: - sys.exit(main()) + sys.exit(main()) except SystemExit, argument: - sys.exit(argument) + sys.exit(argument) except Exception, argument: - info = sys.exc_info() - trace = info[2] - sys.stderr.write("%s %s\n" % (sys.exc_type, argument)) - sys.stderr.write("LINE %d\n" % (trace.tb_lineno)) - sys.exit(111) # Soft failure, try again later. + info = sys.exc_info() + trace = info[2] + sys.stderr.write("%s %s\n" % (sys.exc_type, argument)) + sys.stderr.write("LINE %d\n" % (trace.tb_lineno)) + sys.exit(111) # Soft failure, try again later. === modified file 'contrib/rotatelogs.py' --- contrib/rotatelogs.py 2018-06-17 23:47:34 +0000 +++ contrib/rotatelogs.py 2019-01-29 05:48:13 +0000 @@ -37,7 +37,7 @@ # Please direct questions on this to the above address. # -showLines = 100 # lines of log messages to display before truncating +showLines = 100 # lines of log messages to display before truncating import sys, os, string, time, errno import paths @@ -59,45 +59,45 @@ logDate = time.strftime('%Y%m%d-%H%M%S', time.localtime(time.time())) textSend = 0 for log in ( 'error', 'smtp-failures' ): - fileName = os.path.join(mm_cfg.LOG_DIR, log) - - # rotate file if it contains any data - stats = os.stat(fileName) - if stats[stat.ST_SIZE] < 1: continue - fileNameNew = '%s.%s' % ( fileName, logDate ) - newLogfiles.append(fileNameNew) - os.rename(fileName, fileNameNew) - open(fileName, 'w') - os.chmod(fileName, stat.S_IMODE(stats[stat.ST_MODE])) - try: os.chown(fileName, stats[stat.ST_UID], stats[stat.ST_GID]) - except OSError: pass # permission denied, DOH! - - textSend = 1 - tmp = '# FILE: %s #' % fileNameNew - text.append('#' * len(tmp)) - text.append(tmp) - text.append('#' * len(tmp)) - text.append('') - - linesLeft = showLines # e-mail first linesLeft of log files - for line in fileinput.input(fileNameNew): - if linesLeft == 0: - text.append('[... truncated ...]') - break - linesLeft = linesLeft - 1 - line = string.rstrip(line) - text.append(line) - text.append('') + fileName = os.path.join(mm_cfg.LOG_DIR, log) + + # rotate file if it contains any data + stats = os.stat(fileName) + if stats[stat.ST_SIZE] < 1: continue + fileNameNew = '%s.%s' % ( fileName, logDate ) + newLogfiles.append(fileNameNew) + os.rename(fileName, fileNameNew) + open(fileName, 'w') + os.chmod(fileName, stat.S_IMODE(stats[stat.ST_MODE])) + try: os.chown(fileName, stats[stat.ST_UID], stats[stat.ST_GID]) + except OSError: pass # permission denied, DOH! + + textSend = 1 + tmp = '# FILE: %s #' % fileNameNew + text.append('#' * len(tmp)) + text.append(tmp) + text.append('#' * len(tmp)) + text.append('') + + linesLeft = showLines # e-mail first linesLeft of log files + for line in fileinput.input(fileNameNew): + if linesLeft == 0: + text.append('[... truncated ...]') + break + linesLeft = linesLeft - 1 + line = string.rstrip(line) + text.append(line) + text.append('') # send message if we've actually found anything if textSend: - text = string.join(text, '\n') + '\n' - siteowner = Utils.get_site_email() - Utils.SendTextToUser( - 'Mailman Log Report -- %s' % time.ctime(time.time()), - text, siteowner, siteowner) + text = string.join(text, '\n') + '\n' + siteowner = Utils.get_site_email() + Utils.SendTextToUser( + 'Mailman Log Report -- %s' % time.ctime(time.time()), + text, siteowner, siteowner) # compress any log-files we made if hasattr(mm_cfg, 'COMPRESS_LOGFILES_WITH') and mm_cfg.COMPRESS_LOGFILES_WITH: - for file in newLogfiles: - os.system(mm_cfg.COMPRESS_LOGFILES_WITH % file) + for file in newLogfiles: + os.system(mm_cfg.COMPRESS_LOGFILES_WITH % file)
_______________________________________________ Mailman-checkins mailing list Mailman-checkins@python.org Unsubscribe: https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org