Removed unused imports.
- Legacy-Id: 16402
This commit is contained in:
parent
f480799af9
commit
0679eaa8d4
|
@ -1,6 +1,5 @@
|
|||
# Copyright The IETF Trust 2015-2019, All Rights Reserved
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from ietf.name.models import BallotPositionName
|
|||
from ietf.iesg.models import TelechatDate
|
||||
from ietf.person.models import Person, PersonalApiKey
|
||||
from ietf.person.factories import PersonFactory
|
||||
from ietf.utils.test_utils import TestCase, unicontent, login_testing_unauthorized
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
|
||||
from ietf.utils.mail import outbox, empty_outbox
|
||||
from ietf.utils.text import unwrap
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from ietf.group.factories import RoleFactory, GroupFactory
|
|||
from ietf.group.models import Group, GroupMilestone
|
||||
from ietf.iesg.models import TelechatDate
|
||||
from ietf.person.models import Person
|
||||
from ietf.utils.test_utils import TestCase, unicontent
|
||||
from ietf.utils.test_utils import TestCase
|
||||
from ietf.utils.mail import outbox, empty_outbox
|
||||
from ietf.utils.test_utils import login_testing_unauthorized
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ from ietf.person.factories import PersonFactory
|
|||
from ietf.person.models import Person, Email
|
||||
from ietf.meeting.models import Meeting, MeetingTypeName
|
||||
from ietf.iesg.models import TelechatDate
|
||||
from ietf.utils.test_utils import login_testing_unauthorized, unicontent
|
||||
from ietf.utils.test_utils import login_testing_unauthorized
|
||||
from ietf.utils.mail import outbox, empty_outbox
|
||||
from ietf.utils.test_utils import TestCase
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from ietf.meeting.factories import MeetingFactory
|
|||
from ietf.meeting.models import Meeting, Session, SessionPresentation
|
||||
from ietf.name.models import SessionStatusName
|
||||
from ietf.person.models import Person
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized, unicontent
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
|
||||
|
||||
|
||||
class GroupMaterialTests(TestCase):
|
||||
|
|
|
@ -769,7 +769,7 @@ def search_mail_archive(request, name, assignment_id):
|
|||
try:
|
||||
res["messages"] = mailarch.retrieve_messages(res["query_data_url"])[:MAX_RESULTS]
|
||||
except KeyError as e:
|
||||
res["error"] = "No results found"
|
||||
res["error"] = "No results found (%s)" % str(e)
|
||||
except Exception as e:
|
||||
res["error"] = "Retrieval from mail archive failed: %s" % str(e)
|
||||
# raise # useful when debugging
|
||||
|
|
|
@ -19,7 +19,7 @@ from ietf.group.factories import GroupFactory, RoleFactory
|
|||
from ietf.utils.test_runner import set_coverage_checking
|
||||
from ietf.person.factories import EmailFactory
|
||||
from ietf.person.models import Person
|
||||
from ietf.utils.test_utils import login_testing_unauthorized, TestCase, unicontent
|
||||
from ietf.utils.test_utils import login_testing_unauthorized, TestCase
|
||||
|
||||
if getattr(settings,'SKIP_DOT_TO_PDF', False):
|
||||
skip_dot_to_pdf = True
|
||||
|
|
|
@ -8,7 +8,7 @@ from pyquery import PyQuery
|
|||
|
||||
from django.urls import reverse as urlreverse
|
||||
|
||||
from ietf.utils.test_utils import login_testing_unauthorized, TestCase, unicontent, reload_db_objects
|
||||
from ietf.utils.test_utils import login_testing_unauthorized, TestCase, reload_db_objects
|
||||
from ietf.doc.models import TelechatDocEvent
|
||||
from ietf.group.models import Role
|
||||
from ietf.iesg.models import TelechatDate
|
||||
|
|
|
@ -179,7 +179,7 @@ def agenda_json(request, date=None):
|
|||
|
||||
s["docs"].append(docinfo)
|
||||
|
||||
return HttpResponse(json.dumps(res, indent=2), content_type='text/plain')
|
||||
return HttpResponse(json.dumps(res, indent=2), content_type='application/json')
|
||||
|
||||
# def past_agendas(request):
|
||||
# # This is not particularly useful with the current way of constructing
|
||||
|
|
|
@ -14,7 +14,7 @@ from django.conf import settings
|
|||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized, unicontent
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
|
||||
from ietf.utils.mail import outbox, empty_outbox
|
||||
from ietf.group.models import Group, Role, RoleName
|
||||
from ietf.group.factories import GroupFactory, RoleFactory
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
# Copyright The IETF Trust 2014-2019, All Rights Reserved
|
||||
|
||||
import base64
|
||||
import email
|
||||
import datetime
|
||||
|
@ -6,8 +7,11 @@ from dateutil.tz import tzoffset
|
|||
import os
|
||||
import pytz
|
||||
import re
|
||||
|
||||
from django.template.loader import render_to_string
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.ipr.models import IprEvent
|
||||
from ietf.message.models import Message
|
||||
from ietf.person.models import Person
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
# Copyright The IETF Trust 2009-2019, All Rights Reserved
|
||||
import datetime, os, shutil
|
||||
import json
|
||||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
|
@ -11,7 +10,7 @@ from django.db.models import Q
|
|||
from io import StringIO
|
||||
from pyquery import PyQuery
|
||||
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized, unicontent
|
||||
from ietf.utils.test_utils import TestCase, login_testing_unauthorized
|
||||
from ietf.utils.mail import outbox
|
||||
|
||||
from ietf.group.factories import GroupFactory, RoleFactory
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright The IETF Trust 2015-2019, All Rights Reserved
|
||||
from django.urls import reverse as urlreverse
|
||||
|
||||
from ietf.utils.test_utils import TestCase, unicontent
|
||||
from ietf.utils.test_utils import TestCase
|
||||
|
||||
class EventMailTests(TestCase):
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import datetime
|
|||
|
||||
from django.urls import reverse as urlreverse
|
||||
|
||||
from ietf.utils.test_utils import TestCase, unicontent
|
||||
from ietf.utils.test_utils import TestCase
|
||||
from ietf.utils.mail import outbox
|
||||
|
||||
from ietf.message.models import Message, SendQueue
|
||||
|
|
|
@ -22,7 +22,10 @@ from ietf.nomcom.utils import (initialize_templates_for_group,
|
|||
initialize_questionnaire_for_position,
|
||||
initialize_requirements_for_position,
|
||||
initialize_description_for_topic,
|
||||
delete_nomcom_templates)
|
||||
delete_nomcom_templates,
|
||||
EncryptedException,
|
||||
)
|
||||
from ietf.utils.log import log
|
||||
from ietf.utils.models import ForeignKey
|
||||
from ietf.utils.pipe import pipe
|
||||
from ietf.utils.storage import NoLocationMigrationFileSystemStorage
|
||||
|
|
|
@ -338,7 +338,7 @@ class PersonalApiKey(models.Model):
|
|||
import struct, hashlib, base64
|
||||
try:
|
||||
key = base64.urlsafe_b64decode(s)
|
||||
except TypeError as e:
|
||||
except TypeError:
|
||||
return None
|
||||
|
||||
id, salt, hash = struct.unpack(KEY_STRUCT, key)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
|
||||
import datetime
|
||||
import json
|
||||
from pyquery import PyQuery
|
||||
from io import StringIO
|
||||
from django.urls import reverse as urlreverse
|
||||
|
|
|
@ -50,7 +50,7 @@ REDIRECT_TESTS = {
|
|||
'/public/idindex.cgi?command=do_search_id&filename=draft-mills-sntp-v4-00.txt':
|
||||
'/drafts/?filename=draft-mills-sntp-v4-00.txt',
|
||||
'/public/idindex.cgi?command=do_search_id&filename=draft-ietf-isis-interoperable&search_button=SEARCH':
|
||||
'/drafts/?search_button=SEARCH&filename=draft-ietf-isis-interoperable',
|
||||
'/drafts/?filename=draft-ietf-isis-interoperable&search_button=SEARCH',
|
||||
'/public/idindex.cgi?command=do_search_id&filename=rfc0038.txt':
|
||||
'/drafts/?filename=rfc0038.txt',
|
||||
'/public/idindex.cgi?command=id_detail&id=7096':
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Copyright The IETF Trust 2013-2019, All Rights Reserved
|
||||
from django.conf import settings
|
||||
|
||||
'''
|
||||
r'''
|
||||
RTF quick reference (from Word2007RTFSpec9.doc):
|
||||
\fs24 : sets the font size to 24 half points
|
||||
\header : header on all pages
|
||||
|
|
|
@ -4,7 +4,7 @@ import datetime
|
|||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.utils.test_utils import TestCase, unicontent
|
||||
from ietf.utils.test_utils import TestCase
|
||||
from ietf.group.factories import GroupFactory, RoleFactory
|
||||
from ietf.meeting.models import Session, ResourceAssociation
|
||||
from ietf.meeting.factories import MeetingFactory, SessionFactory
|
||||
|
|
|
@ -18,4 +18,4 @@ def copy_roles(person):
|
|||
me.role_set.all().delete()
|
||||
for role in person.role_set.all():
|
||||
Role.objects.create(person=me,email_id='rcross@amsl.com',name=role.name,group=role.group)
|
||||
print me.role_set.all()
|
||||
print(me.role_set.all())
|
|
@ -1,5 +1,4 @@
|
|||
# Copyright The IETF Trust 2016-2019, All Rights Reserved
|
||||
# Copyright 2016 IETF Trust
|
||||
|
||||
import os
|
||||
import copy
|
||||
|
@ -61,6 +60,8 @@ class Command(BaseCommand):
|
|||
self.note("Running %s %s ..." % (os.path.basename(cmd), " ".join(quoted_args)))
|
||||
command = [ cmd, ] + list(args)
|
||||
code, out, err = pipe(command)
|
||||
out = out.decode()
|
||||
err = err.decode()
|
||||
msg = None
|
||||
if code != 0:
|
||||
msg = "Error %s: %s when executing '%s'" % (code, err, " ".join(command))
|
||||
|
|
|
@ -72,6 +72,7 @@ def check(codeString, filename, verbosity=1):
|
|||
sys.stderr.write('F')
|
||||
else:
|
||||
sys.stderr.write('.')
|
||||
sys.stderr.flush()
|
||||
if verbosity > 1:
|
||||
sys.stderr.write(" %s\n" % filename)
|
||||
return messages
|
||||
|
@ -84,7 +85,7 @@ def checkPath(filename, verbosity):
|
|||
@return: the number of warnings printed
|
||||
"""
|
||||
try:
|
||||
return check(open(filename, 'U').read() + '\n', filename, verbosity)
|
||||
return check(open(filename).read() + '\n', filename, verbosity)
|
||||
except IOError as msg:
|
||||
return ["%s: %s" % (filename, msg.args[1])]
|
||||
except TypeError:
|
||||
|
@ -100,7 +101,7 @@ def checkPaths(filenames, verbosity):
|
|||
try:
|
||||
warnings.extend(checkPath(os.path.join(dirpath, filename), verbosity))
|
||||
except TypeError as e:
|
||||
print(("Exception while processing dirpath=%s, filename=%s: %s" % (dirpath, filename,e )))
|
||||
print("Exception while processing dirpath=%s, filename=%s: %s" % (dirpath, filename, e ))
|
||||
raise
|
||||
else:
|
||||
warnings.extend(checkPath(arg, verbosity))
|
||||
|
|
|
@ -97,7 +97,7 @@ class Command(BaseCommand):
|
|||
'person': person, 'settings': settings,
|
||||
},
|
||||
)
|
||||
e = PersonEvent.objects.create(person=person, type='gdpr_notice_email',
|
||||
PersonEvent.objects.create(person=person, type='gdpr_notice_email',
|
||||
desc="Sent GDPR notice email to %s with confirmation deadline %s" % (to, date))
|
||||
time.sleep(delay)
|
||||
|
||||
|
|
|
@ -239,7 +239,6 @@ def save_test_results(failures, test_labels):
|
|||
tfile.write("%s OK\n" % (timestr, ))
|
||||
tfile.close()
|
||||
|
||||
|
||||
def set_coverage_checking(flag=True):
|
||||
global template_coverage_collection
|
||||
global code_coverage_collection
|
||||
|
|
|
@ -11,8 +11,8 @@ from email.mime.multipart import MIMEMultipart
|
|||
from email.mime.text import MIMEText
|
||||
from fnmatch import fnmatch
|
||||
from importlib import import_module
|
||||
from .pipe import pipe
|
||||
from io import StringIO
|
||||
#from .pipe import pipe
|
||||
#from io import StringIO
|
||||
from textwrap import dedent
|
||||
from unittest import skipIf
|
||||
from tempfile import mkdtemp
|
||||
|
@ -20,7 +20,7 @@ from tempfile import mkdtemp
|
|||
from django.apps import apps
|
||||
from django.contrib.auth.models import User
|
||||
from django.conf import settings
|
||||
from django.core.management import call_command
|
||||
#from django.core.management import call_command
|
||||
from django.template import Context
|
||||
from django.template.defaulttags import URLNode
|
||||
from django.template.loader import get_template
|
||||
|
@ -29,8 +29,8 @@ from django.urls import reverse as urlreverse
|
|||
|
||||
import debug # pyflakes:ignore
|
||||
|
||||
from ietf.group.factories import GroupFactory
|
||||
from ietf.group.models import Group
|
||||
#from ietf.group.factories import GroupFactory
|
||||
#from ietf.group.models import Group
|
||||
from ietf.person.name import name_parts, unidecode_name
|
||||
from ietf.submit.tests import submission_file
|
||||
from ietf.utils.bower_storage import BowerStorageFinder
|
||||
|
@ -294,43 +294,43 @@ class TestWikiGlueManagementCommand(TestCase):
|
|||
shutil.rmtree(os.path.dirname(self.wiki_dir_pattern))
|
||||
shutil.rmtree(os.path.dirname(self.svn_dir_pattern))
|
||||
|
||||
def test_wiki_create_output(self):
|
||||
for type in ['wg','rg','ag','area']:
|
||||
GroupFactory(type_id=type)
|
||||
groups = Group.objects.filter(
|
||||
type__slug__in=['wg','rg','ag','area'],
|
||||
state__slug='active'
|
||||
).order_by('acronym')
|
||||
out = StringIO()
|
||||
err = StringIO()
|
||||
call_command('create_group_wikis', stdout=out, stderr=err, verbosity=2,
|
||||
wiki_dir_pattern=self.wiki_dir_pattern,
|
||||
svn_dir_pattern=self.svn_dir_pattern,
|
||||
)
|
||||
command_output = out.getvalue()
|
||||
command_errors = err.getvalue()
|
||||
self.assertEqual("", command_errors)
|
||||
for group in groups:
|
||||
self.assertIn("Processing group '%s'" % group.acronym, command_output)
|
||||
# Do a bit of verification using trac-admin, too
|
||||
admin_code, admin_output, admin_error = pipe(
|
||||
'trac-admin %s permission list' % (self.wiki_dir_pattern % group.acronym))
|
||||
self.assertEqual(admin_code, 0)
|
||||
roles = group.role_set.filter(name_id__in=['chair', 'secr', 'ad'])
|
||||
for role in roles:
|
||||
user = role.email.address.lower()
|
||||
self.assertIn("Granting admin permission for %s" % user, command_output)
|
||||
self.assertIn(user, admin_output)
|
||||
docs = group.document_set.filter(states__slug='active', type_id='draft')
|
||||
for doc in docs:
|
||||
name = doc.name
|
||||
name = name.replace('draft-','')
|
||||
name = name.replace(doc.stream_id+'-', '')
|
||||
name = name.replace(group.acronym+'-', '')
|
||||
self.assertIn("Adding component %s"%name, command_output)
|
||||
for page in settings.TRAC_WIKI_PAGES_TEMPLATES:
|
||||
self.assertIn("Adding page %s" % os.path.basename(page), command_output)
|
||||
self.assertIn("Indexing default repository", command_output)
|
||||
# def test_wiki_create_output(self):
|
||||
# for type in ['wg','rg','ag','area']:
|
||||
# GroupFactory(type_id=type)
|
||||
# groups = Group.objects.filter(
|
||||
# type__slug__in=['wg','rg','ag','area'],
|
||||
# state__slug='active'
|
||||
# ).order_by('acronym')
|
||||
# out = StringIO()
|
||||
# err = StringIO()
|
||||
# call_command('create_group_wikis', stdout=out, stderr=err, verbosity=2,
|
||||
# wiki_dir_pattern=self.wiki_dir_pattern,
|
||||
# svn_dir_pattern=self.svn_dir_pattern,
|
||||
# )
|
||||
# command_output = out.getvalue()
|
||||
# command_errors = err.getvalue()
|
||||
# self.assertEqual("", command_errors)
|
||||
# for group in groups:
|
||||
# self.assertIn("Processing group '%s'" % group.acronym, command_output)
|
||||
# # Do a bit of verification using trac-admin, too
|
||||
# admin_code, admin_output, admin_error = pipe(
|
||||
# 'trac-admin %s permission list' % (self.wiki_dir_pattern % group.acronym))
|
||||
# self.assertEqual(admin_code, 0)
|
||||
# roles = group.role_set.filter(name_id__in=['chair', 'secr', 'ad'])
|
||||
# for role in roles:
|
||||
# user = role.email.address.lower()
|
||||
# self.assertIn("Granting admin permission for %s" % user, command_output)
|
||||
# self.assertIn(user, admin_output)
|
||||
# docs = group.document_set.filter(states__slug='active', type_id='draft')
|
||||
# for doc in docs:
|
||||
# name = doc.name
|
||||
# name = name.replace('draft-','')
|
||||
# name = name.replace(doc.stream_id+'-', '')
|
||||
# name = name.replace(group.acronym+'-', '')
|
||||
# self.assertIn("Adding component %s"%name, command_output)
|
||||
# for page in settings.TRAC_WIKI_PAGES_TEMPLATES:
|
||||
# self.assertIn("Adding page %s" % os.path.basename(page), command_output)
|
||||
# self.assertIn("Indexing default repository", command_output)
|
||||
|
||||
OMITTED_APPS = [
|
||||
'ietf.secr.meetings',
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
import re
|
||||
import textwrap
|
||||
import types
|
||||
import unicodedata
|
||||
|
||||
from django.utils.functional import keep_lazy
|
||||
|
|
|
@ -77,9 +77,12 @@ def validate_mime_type(file, valid):
|
|||
mime_type, encoding = get_mime_type(raw)
|
||||
# work around mis-identification of text where a line has 'virtual' as
|
||||
# the first word:
|
||||
if mime_type == 'text/x-c++' and re.search('(?m)^virtual\s', raw):
|
||||
mod = raw.replace(str('virtual'), str(' virtual'))
|
||||
if mime_type == 'text/x-c++' and re.search(rb'(?m)^virtual\s', raw):
|
||||
mod = raw.replace(b'virtual', b' virtual'))
|
||||
mime_type, encoding = get_mime_type(mod)
|
||||
debug.show('mime_type')
|
||||
debug.show('encoding')
|
||||
debug.show('valid')
|
||||
if valid and not mime_type in valid:
|
||||
raise ValidationError('Found content with unexpected mime type: %s. Expected one of %s.' %
|
||||
(mime_type, ', '.join(valid) ))
|
||||
|
|
|
@ -32,7 +32,6 @@ httplib2>=0.10.3
|
|||
jsonfield>=1.0.3 # for SubmissionCheck. This is https://github.com/bradjasper/django-jsonfield/.
|
||||
jwcrypto>=0.4.0 # for signed notifications
|
||||
#lxml>=3.4.0 # from PyQuery;
|
||||
mimeparse>=0.1.3 # from TastyPie
|
||||
mock>=2.0.0
|
||||
mysqlclient>=1.3.13
|
||||
oauth2client>=4.0.0 # required by google-api-python-client, but not always pulled in
|
||||
|
@ -48,6 +47,7 @@ pyquery>=1.2.13,!=1.2.14 # Pyqyery 1.2.14 fails on some selectors or stacked sel
|
|||
python-dateutil>=2.2
|
||||
python-magic>=0.4.6
|
||||
python-memcached>=1.48 # for django.core.cache.backends.memcached
|
||||
python-mimeparse>=1.6 # from TastyPie
|
||||
pytz>=2014.7
|
||||
#pyzmail>=1.0.3
|
||||
requests!=2.12.*
|
||||
|
|
Loading…
Reference in a new issue