r56121 - sandbox/trunk/pep0/pep0/output.py
Author: brett.cannon Date: Thu Jun 28 22:40:04 2007 New Revision: 56121 Modified: sandbox/trunk/pep0/pep0/output.py Log: Fix bug where an author's email address is not outputted if the author instance does not have an email address during the multiple email check. Modified: sandbox/trunk/pep0/pep0/output.py ============================================================================== --- sandbox/trunk/pep0/pep0/output.py (original) +++ sandbox/trunk/pep0/pep0/output.py Thu Jun 28 22:40:04 2007 @@ -3,7 +3,8 @@ from .pep import PEP from operator import attrgetter -from sys import stdout, stderr +from sys import stdout +import warnings indent = ' ' @@ -33,8 +34,10 @@ # over Type value, and vice-versa. if pep.type_ == 'Process': if pep.status == 'Draft': - print>>stderr, ("index ambiguity: PEP %s is a Draft, Process " - "PEP" % pep.number) + warnings.warn("PEP %s is a Process PEP that is still is a " + "Draft; ambiguous listing in PEP 0" % + pep.number, + UserWarning) meta.append(pep) elif pep.status == 'Draft': open_.append(pep) @@ -76,7 +79,7 @@ too_many_emails = [] for author, emails in authors_dict.items(): if len(emails) > 1: - too_many_emails.append((author.full_name, emails)) + too_many_emails.append((author.first_last, emails)) else: valid_authors_dict[author] = emails[0] if too_many_emails: @@ -163,13 +166,16 @@ authors_dict = verify_email_addresses(peps) max_name = max(authors_dict.keys(), key=lambda x: len(x.last_first)) + max_name_len = len(max_name.last_first) print>>output, " %s %s" % ('name'.ljust(max_name_len), 'email address') print>>output, " %s %s" % ((len('name')*'-').ljust(max_name_len), len('email address')*'-') sorted_authors = sort_authors(authors_dict) for author in sorted_authors: + # Use the email from authors_dict instead of the one from 'author' as + # the author instance may have an empty email. print>>output, (" %s %s" % - (author.last_first.ljust(max_name_len), author.email)) + (author.last_first.ljust(max_name_len), authors_dict[author])) print>>output print>>output print>>output, "References"
participants (1)
-
brett.cannon