diff --git a/ietf/utils/draft.py b/ietf/utils/draft.py index 747313ba4..1e72a6ea9 100755 --- a/ietf/utils/draft.py +++ b/ietf/utils/draft.py @@ -191,14 +191,12 @@ class Draft(): pages = [] page = [] line = "" - debug = False newpage = False sentence = False blankcount = 0 linecount = 0 # two functions with side effects def striplines(p): - r = [] beg = end = 0 for i in range(len(p)): l = p[i] @@ -522,7 +520,6 @@ class Draft(): authors = [] companies = [] - author_info = [] companies_seen = [] self._docheader = "" @@ -533,7 +530,7 @@ class Draft(): for line in self.lines[:30]: self._docheader += line+"\n" author_on_line = False - company_on_line = False + _debug( "**" + line) leading_space = len(re.findall("^ *", line)[0]) line_len = len(line.rstrip()) @@ -609,7 +606,6 @@ class Draft(): company = match.group(1) authors += [ "" ] companies += [ company ] - company_on_line = True #_debug("\nLine: " + line) #_debug("Format: " + authformat) _debug("Company: '%s'" % company) @@ -772,7 +768,7 @@ class Draft(): authors[i] = (fullname, first, middle, surname, suffix) companies[i] = None break - except AssertionError, e: + except AssertionError: sys.stderr.write("filename: "+self.filename+"\n") sys.stderr.write("authpat: "+authpat+"\n") raise @@ -788,9 +784,7 @@ class Draft(): _debug("2: authors[%s]: %s" % (i, authors[i])) if start and col != None: _debug("\n * %s" % (authors[i], )) - done = False nonblank_count = 0 - keyword = False blanklines = 0 email = None for line in self.lines[start+1:]: @@ -1101,6 +1095,7 @@ def getmeta(fn): # ---------------------------------------------------------------------- def _output(docname, fields, outfile=sys.stdout): + global company_domain if opt_getauthors: # Output an (incomplete!) getauthors-compatible format. Country # information is always UNKNOWN, and information about security and @@ -1165,6 +1160,7 @@ def _printmeta(fn, outfile=sys.stdout): # Main # ---------------------------------------------------------------------- +company_domain = {} def _main(outfile=sys.stdout): global opt_debug, opt_timestamp, opt_trace, opt_authorinfo, opt_getauthors, files, company_domain, opt_attributes # set default values, if any @@ -1234,6 +1230,7 @@ def _main(outfile=sys.stdout): if file == "-": file = sys.stdin elif file.endswith(".gz"): + import gzip file = gzip.open(file) else: file = open(file) diff --git a/ietf/utils/mail.py b/ietf/utils/mail.py index 617a21f89..4c6603331 100644 --- a/ietf/utils/mail.py +++ b/ietf/utils/mail.py @@ -325,7 +325,7 @@ def smtp_error_logging(thing): """) % e.original_msg.as_string() try: send_mail_preformatted(request=None, preformatted=msg) - except smtplib.SMTPException as ticket_mail_error: + except smtplib.SMTPException: log("Exception encountered while sending a ticket to the secretariat") (extype,value) = sys.exc_info()[:2] log("SMTP Exception: %s : %s" % (extype,value)) diff --git a/ietf/utils/test_data.py b/ietf/utils/test_data.py index 8d7e05210..01ec70b1d 100644 --- a/ietf/utils/test_data.py +++ b/ietf/utils/test_data.py @@ -1,16 +1,16 @@ +import datetime + from django.conf import settings from django.contrib.auth.models import User -from ietf.iesg.models import TelechatDate +import debug # pyflakes:ignore + +from ietf.doc.models import Document, DocAlias, State, DocumentAuthor, BallotType, DocEvent, BallotDocEvent +from ietf.group.models import Group, GroupHistory, Role, RoleHistory from ietf.ipr.models import IprDetail, IprDocAlias from ietf.meeting.models import Meeting -from ietf.doc.models import * -from ietf.doc.utils import * -from ietf.name.models import * -from ietf.group.models import * -from ietf.person.models import * - -import debug # pyflakes:ignore +from ietf.name.models import StreamName +from ietf.person.models import Person, Alias, Email def create_person(group, role_name, name=None, username=None, email_address=None): """Add person/user/email and role.""" @@ -36,12 +36,12 @@ def make_immutable_base_data(): all tests in a run.""" # telechat dates - t = datetime.date.today() - old = TelechatDate.objects.create(date=t - datetime.timedelta(days=14)).date - date1 = TelechatDate.objects.create(date=t).date - date2 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14)).date - date3 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 2)).date - date4 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 3)).date + #t = datetime.date.today() + #old = TelechatDate.objects.create(date=t - datetime.timedelta(days=14)).date + #date1 = TelechatDate.objects.create(date=t).date + #date2 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14)).date + #date3 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 2)).date + #date4 = TelechatDate.objects.create(date=t + datetime.timedelta(days=14 * 3)).date # system system_person = Person.objects.create(name="(System)", ascii="(System)", address="") @@ -77,9 +77,9 @@ def make_immutable_base_data(): rfc_editor = create_group(name="RFC Editor", acronym="rfceditor", type_id="rfcedtyp") create_person(rfc_editor, "auth", name="Rfc Editor", username="rfc", email_address="rfc@edit.or") - iesg = create_group(name="Internet Engineering Steering Group", acronym="iesg", type_id="ietf", parent=ietf) + iesg = create_group(name="Internet Engineering Steering Group", acronym="iesg", type_id="ietf", parent=ietf) # pyflakes:ignore - individ = create_group(name="Individual submissions", acronym="none", type_id="individ") + individ = create_group(name="Individual submissions", acronym="none", type_id="individ") # pyflakes:ignore # one area area = create_group(name="Far Future", acronym="farfut", type_id="area", parent=ietf) @@ -165,7 +165,7 @@ def make_test_data(): # plain IETF'er u = User.objects.create(username="plain") plainman = Person.objects.create(name="Plain Man", ascii="Plain Man", user=u) - email = Email.objects.create(address="plain@example.com", person=plainman) + email = Email.objects.create(address="plain@example.com", person=plainman) # pyflakes:ignore # group personnel create_person(mars_wg, "chair", name="WG Chair Man", username="marschairman") @@ -294,7 +294,7 @@ def make_test_data(): target_rfc.set_state(State.objects.get(slug='rfc',type__slug='draft')) target_rfc.save() docalias = DocAlias.objects.create(name=name,document=target_rfc) - docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc) + docalias = DocAlias.objects.create(name='rfc%d'%rfc_num,document=target_rfc) # pyflakes:ignore return target_rfc rfc_for_status_change_test_factory('draft-ietf-random-thing',9999,'ps') rfc_for_status_change_test_factory('draft-ietf-random-otherthing',9998,'inf') diff --git a/ietf/utils/test_utils.py b/ietf/utils/test_utils.py index 9fe7be1c4..909ee4f32 100644 --- a/ietf/utils/test_utils.py +++ b/ietf/utils/test_utils.py @@ -40,9 +40,8 @@ import urllib2 as urllib from difflib import unified_diff import django.test -from django.db import connection, connections, transaction, DEFAULT_DB_ALIAS +from django.db import connection, connections, DEFAULT_DB_ALIAS from django.test.testcases import connections_support_transactions -from django.test.testcases import disable_transaction_methods from django.test.client import Client from django.conf import settings from django.core.management import call_command