Initial 2to3 patch with added copyright statement updates.

- Legacy-Id: 16309
This commit is contained in:
Henrik Levkowetz 2019-06-27 14:40:54 +00:00
parent 1615f46fb5
commit d7f5c84182
357 changed files with 1519 additions and 1338 deletions

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2007-2019, All Rights Reserved
# -*- coding: utf-8 -*-
import checks # pyflakes:ignore
from . import checks # pyflakes:ignore
# Don't add patch number here:
__version__ = "6.98.2.dev0"

View file

@ -1,7 +1,8 @@
# Copyright The IETF Trust 2014-2019, All Rights Reserved
import re
import six
import datetime
from urllib import urlencode
from urllib.parse import urlencode
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
@ -129,9 +130,9 @@ class ToOneField(tastypie.fields.ToOneField):
if not foreign_obj:
if not self.null:
if callable(self.attribute):
raise ApiFieldError(u"The related resource for resource %s could not be found." % (previous_obj))
raise ApiFieldError("The related resource for resource %s could not be found." % (previous_obj))
else:
raise ApiFieldError(u"The model '%r' has an empty attribute '%s' and doesn't allow a null value." % (previous_obj, attr))
raise ApiFieldError("The model '%r' has an empty attribute '%s' and doesn't allow a null value." % (previous_obj, attr))
return None
fk_resource = self.get_related_resource(foreign_obj)

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2014-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
import datetime
@ -66,7 +66,7 @@ class Command(AppCommand):
app_resources = {}
if os.path.exists(resource_file_path):
resources = import_module("%s.resources" % app.name)
for n,v in resources.__dict__.items():
for n,v in list(resources.__dict__.items()):
if issubclass(type(v), type(ModelResource)):
app_resources[n] = v
@ -164,7 +164,7 @@ class Command(AppCommand):
fields=model._meta.fields,
m2m_fields=model._meta.many_to_many,
name=model_name,
imports=[ v for k,v in imports.items() ],
imports=[ v for k,v in list(imports.items()) ],
foreign_keys=foreign_keys,
m2m_keys=m2m_keys,
resource_name=resource_name,
@ -184,7 +184,7 @@ class Command(AppCommand):
while len(new_models) > 0:
list_len = len(new_models)
#debug.show('len(new_models)')
keys = new_models.keys()
keys = list(new_models.keys())
for model_name in keys:
internal_fk_count = 0
for fk in new_models[model_name]["foreign_keys"]+new_models[model_name]["m2m_keys"]:
@ -207,7 +207,7 @@ class Command(AppCommand):
internal_fk_count_limit += 1
else:
print("Failed also with partial ordering, writing resource classes without ordering")
new_model_list = [ v for k,v in new_models.items() ]
new_model_list = [ v for k,v in list(new_models.items()) ]
break
if rfile.tell() == 0:

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
import hashlib
import json
@ -16,7 +17,7 @@ import debug # pyflakes:ignore
def filter_from_queryargs(request):
#@debug.trace
def fix_ranges(d):
for k,v in d.items():
for k,v in list(d.items()):
if v.startswith("[") and v.endswith("]"):
d[k] = [ s for s in v[1:-1].split(",") if s ]
elif "," in v:
@ -27,9 +28,9 @@ def filter_from_queryargs(request):
def is_ascii(s):
return all(ord(c) < 128 for c in s)
# limit parameter keys to ascii.
params = dict( (k,v) for (k,v) in request.GET.items() if is_ascii(k) )
filter = fix_ranges(dict([(k,params[k]) for k in params.keys() if not k.startswith("not__")]))
exclude = fix_ranges(dict([(k[5:],params[k]) for k in params.keys() if k.startswith("not__")]))
params = dict( (k,v) for (k,v) in list(request.GET.items()) if is_ascii(k) )
filter = fix_ranges(dict([(k,params[k]) for k in list(params.keys()) if not k.startswith("not__")]))
exclude = fix_ranges(dict([(k[5:],params[k]) for k in list(params.keys()) if k.startswith("not__")]))
return filter, exclude
def unique_obj_name(obj):
@ -147,7 +148,7 @@ class AdminJsonSerializer(Serializer):
if hasattr(field_value, "_meta"):
self._current[name] = self.expand_related(field_value, name)
else:
self._current[name] = unicode(field_value)
self._current[name] = str(field_value)
except ObjectDoesNotExist:
pass
except AttributeError:
@ -224,7 +225,7 @@ class JsonExportMixin(object):
def json_view(self, request, filter={}, expand=[]):
qfilter, exclude = filter_from_queryargs(request)
for k in qfilter.keys():
for k in list(qfilter.keys()):
if k.startswith("_"):
del qfilter[k]
qfilter.update(filter)
@ -244,7 +245,7 @@ class JsonExportMixin(object):
try:
qs = self.get_queryset().filter(**filter).exclude(**exclude)
except (FieldError, ValueError) as e:
return HttpResponse(json.dumps({u"error": str(e)}, sort_keys=True, indent=3), content_type=content_type)
return HttpResponse(json.dumps({"error": str(e)}, sort_keys=True, indent=3), content_type=content_type)
try:
if expand:
qs = qs.select_related()
@ -252,7 +253,7 @@ class JsonExportMixin(object):
items = [(getattr(o, key), serializer.serialize([o], expand=expand, query_info=query_info) ) for o in qs ]
qd = dict( ( k, json.loads(v)[0] ) for k,v in items )
except (FieldError, ValueError) as e:
return HttpResponse(json.dumps({u"error": str(e)}, sort_keys=True, indent=3), content_type=content_type)
return HttpResponse(json.dumps({"error": str(e)}, sort_keys=True, indent=3), content_type=content_type)
text = json.dumps({smart_text(self.model._meta): qd}, sort_keys=True, indent=3)
return HttpResponse(text, content_type=content_type)

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2015-2018, All Rights Reserved
# Copyright The IETF Trust 2015-2019, All Rights Reserved
import json
import os
@ -218,8 +218,8 @@ class TastypieApiTestCase(ResourceTestCaseMixin, TestCase):
#
model_list = apps.get_app_config(name).get_models()
for model in model_list:
if not model._meta.model_name in app_resources.keys():
if not model._meta.model_name in list(app_resources.keys()):
#print("There doesn't seem to be any resource for model %s.models.%s"%(app.__name__,model.__name__,))
self.assertIn(model._meta.model_name, app_resources.keys(),
self.assertIn(model._meta.model_name, list(app_resources.keys()),
"There doesn't seem to be any API resource for model %s.models.%s"%(app.__name__,model.__name__,))

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2017, All Rights Reserved
# Copyright The IETF Trust 2017-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from jwcrypto.jwk import JWK

View file

@ -1,24 +1,24 @@
# Copyright The IETF Trust 2017-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from ietf.community.models import CommunityList, SearchRule, EmailSubscription
class CommunityListAdmin(admin.ModelAdmin):
list_display = [u'id', 'user', 'group']
list_display = ['id', 'user', 'group']
raw_id_fields = ['user', 'group', 'added_docs']
admin.site.register(CommunityList, CommunityListAdmin)
class SearchRuleAdmin(admin.ModelAdmin):
list_display = [u'id', 'community_list', 'rule_type', 'state', 'group', 'person', 'text']
list_display = ['id', 'community_list', 'rule_type', 'state', 'group', 'person', 'text']
raw_id_fields = ['community_list', 'state', 'group', 'person', 'name_contains_index']
search_fields = ['person__name', 'group__acronym', 'text', ]
admin.site.register(SearchRule, SearchRuleAdmin)
class EmailSubscriptionAdmin(admin.ModelAdmin):
list_display = [u'id', 'community_list', 'email', 'notify_on']
list_display = ['id', 'community_list', 'email', 'notify_on']
raw_id_fields = ['community_list', 'email']
admin.site.register(EmailSubscription, EmailSubscriptionAdmin)

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
from django import forms
from django.db.models import Q
@ -82,9 +83,9 @@ class SearchRuleForm(forms.ModelForm):
if 'group' in self.fields:
self.fields['group'].queryset = self.fields['group'].queryset.filter(state="active").order_by("acronym")
self.fields['group'].choices = [(g.pk, u"%s - %s" % (g.acronym, g.name)) for g in self.fields['group'].queryset]
self.fields['group'].choices = [(g.pk, "%s - %s" % (g.acronym, g.name)) for g in self.fields['group'].queryset]
for name, f in self.fields.iteritems():
for name, f in self.fields.items():
f.required = True
def clean_text(self):

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-21 14:23
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-21 14:27
from __future__ import unicode_literals
import sys
@ -21,7 +21,7 @@ def forward(apps, schema_editor):
# Document id fixup ------------------------------------------------------------
objs = Document.objects.in_bulk()
nameid = { o.name: o.id for id, o in objs.iteritems() }
nameid = { o.name: o.id for id, o in objs.items() }
sys.stderr.write('\n')

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-22 08:15
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-22 08:15
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-27 05:56
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-30 03:06
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
from django.contrib.auth.models import User
from django.db import models
from django.db.models import signals
@ -89,7 +90,7 @@ class EmailSubscription(models.Model):
notify_on = models.CharField(max_length=30, choices=NOTIFICATION_CHOICES, default="all")
def __unicode__(self):
return u"%s to %s (%s changes)" % (self.email, self.community_list, self.notify_on)
return "%s to %s (%s changes)" % (self.email, self.community_list, self.notify_on)
def notify_events(sender, instance, **kwargs):

View file

@ -196,7 +196,7 @@ def export_to_csv(request, username=None, acronym=None, group_type=None):
row.append(e.time.strftime("%Y-%m-%d") if e else "")
row.append(strip_tags(doc.friendly_state()))
row.append(doc.group.acronym if doc.group else "")
row.append(unicode(doc.ad) if doc.ad else "")
row.append(str(doc.ad) if doc.ad else "")
e = doc.latest_event()
row.append(e.time.strftime("%Y-%m-%d") if e else "")
writer.writerow([v.encode("utf-8") for v in row])
@ -222,7 +222,7 @@ def feed(request, username=None, acronym=None, group_type=None):
host = request.get_host()
feed_url = 'https://%s%s' % (host, request.get_full_path())
feed_id = uuid.uuid5(uuid.NAMESPACE_URL, feed_url.encode('utf-8'))
title = u'%s RSS Feed' % clist.long_name()
title = '%s RSS Feed' % clist.long_name()
if significant:
subtitle = 'Significant document changes'
else:

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2010, All Rights Reserved
# Copyright The IETF Trust 2010-2019, All Rights Reserved
# coding: latin-1
from types import ModuleType
@ -9,7 +9,7 @@ DEBUG_EMAILS = [
('Tero Kivinen', 'kivinen@iki.fi'),
]
for k in locals().keys():
for k in list(locals().keys()):
m = locals()[k]
if isinstance(m, ModuleType):
if hasattr(m, "DEBUG_EMAILS"):

View file

@ -1,5 +1,6 @@
# Copyright The IETF Trust 2015-2019, All Rights Reserved
from pyquery import PyQuery
from Cookie import SimpleCookie
from http.cookies import SimpleCookie
from django.urls import reverse as urlreverse
@ -12,7 +13,7 @@ class CookieTests(TestCase):
def test_settings_defaults(self):
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -24,7 +25,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'off', 'new_enough' : '7', 'expires_soon' : 7, 'left_menu': 'on', })
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/7"]').contents(), ['7 days'])
@ -60,7 +61,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'on', 'new_enough' : '90', 'expires_soon' : 7, 'left_menu': 'off', })
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/90"]').contents(), ['90 days'])
@ -74,7 +75,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'off', 'new_enough' : '60', 'expires_soon' : 14, 'left_menu': 'on', })
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/60"]').contents(), ['60 days'])
@ -88,7 +89,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'on', 'new_enough' : '30', 'expires_soon' : 21, 'left_menu': 'off'})
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/30"]').contents(), ['30 days'])
@ -102,7 +103,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'off', 'new_enough' : '21', 'expires_soon' : 30, 'left_menu': 'on', })
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/21"]').contents(), ['21 days'])
@ -116,7 +117,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'on', 'new_enough' : '14', 'expires_soon' : 60, 'left_menu': 'off', })
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -130,7 +131,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'off', 'new_enough' : '7', 'expires_soon' : 90, 'left_menu': 'on', })
r = self.client.get(urlreverse("ietf.cookies.views.preferences"))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/7"]').contents(), ['7 days'])
@ -145,7 +146,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.full_draft")) # no value: reset
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['full_draft'].value, '')
self.assertListEqual(['full_draft'], r.cookies.keys())
self.assertListEqual(['full_draft'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -159,7 +160,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.full_draft", kwargs=dict(enabled="on")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['full_draft'].value, 'on')
self.assertListEqual(['full_draft'], r.cookies.keys())
self.assertListEqual(['full_draft'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
# self.assertRegexpMatches(r.content, r'ietf-highlight-y.*full_draft.*on')
@ -169,7 +170,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.full_draft", kwargs=dict(enabled="off")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['full_draft'].value, 'off')
self.assertListEqual(['full_draft'], r.cookies.keys())
self.assertListEqual(['full_draft'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
# self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -180,7 +181,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'off', 'new_enough' : '14', 'expires_soon' : 14})
r = self.client.get(urlreverse("ietf.cookies.views.full_draft", kwargs=dict(enabled="foo")))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
# self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -192,7 +193,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.left_menu")) # no value: reset
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['left_menu'].value, '')
self.assertListEqual(['left_menu'], r.cookies.keys())
self.assertListEqual(['left_menu'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/left_menu/off"]').contents(), ['Off'])
@ -204,7 +205,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.left_menu", kwargs=dict(enabled="on")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['left_menu'].value, 'on')
self.assertListEqual(['left_menu'], r.cookies.keys())
self.assertListEqual(['left_menu'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/left_menu/on"]').contents(), ['On'])
@ -213,7 +214,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.left_menu", kwargs=dict(enabled="off")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['left_menu'].value, 'off')
self.assertListEqual(['left_menu'], r.cookies.keys())
self.assertListEqual(['left_menu'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/left_menu/off"]').contents(), ['Off'])
@ -221,7 +222,7 @@ class CookieTests(TestCase):
self.client.cookies = SimpleCookie({'full_draft': 'off', 'new_enough' : '14', 'expires_soon' : 14, 'left_menu': 'off', })
r = self.client.get(urlreverse("ietf.cookies.views.left_menu", kwargs=dict(enabled="foo")))
self.assertEqual(r.status_code, 200)
self.assertListEqual([], r.cookies.keys())
self.assertListEqual([], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/left_menu/off"]').contents(), ['Off'])
@ -230,7 +231,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough")) # no value: reset
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -244,7 +245,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough", kwargs=dict(days="7")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '7')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/7"]').contents(), ['7 days'])
@ -258,7 +259,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough", kwargs=dict(days="14")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '14')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -272,7 +273,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough", kwargs=dict(days="21")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '21')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/21"]').contents(), ['21 days'])
@ -286,7 +287,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough", kwargs=dict(days="30")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '30')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/30"]').contents(), ['30 days'])
@ -300,7 +301,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough", kwargs=dict(days="60")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '60')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/60"]').contents(), ['60 days'])
@ -314,7 +315,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.new_enough", kwargs=dict(days="90")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['new_enough'].value, '90')
self.assertListEqual(['new_enough'], r.cookies.keys())
self.assertListEqual(['new_enough'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/90"]').contents(), ['90 days'])
@ -328,7 +329,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon")) # no value: reset
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -342,7 +343,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon", kwargs=dict(days="7")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '7')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/21"]').contents(), ['21 days'])
@ -356,7 +357,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon", kwargs=dict(days="14")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '14')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href^="/accounts/settings/new_enough/"]').contents(), [])
@ -370,7 +371,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon", kwargs=dict(days="21")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '21')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/on"]').contents(), ['On'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/90"]').contents(), ['90 days'])
@ -384,7 +385,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon", kwargs=dict(days="30")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '30')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/7"]').contents(), ['7 days'])
@ -398,7 +399,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon", kwargs=dict(days="60")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '60')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/14"]').contents(), ['14 days'])
@ -412,7 +413,7 @@ class CookieTests(TestCase):
r = self.client.get(urlreverse("ietf.cookies.views.expires_soon", kwargs=dict(days="90")))
self.assertEqual(r.status_code, 200)
self.assertEqual(r.cookies['expires_soon'].value, '90')
self.assertListEqual(['expires_soon'], r.cookies.keys())
self.assertListEqual(['expires_soon'], list(r.cookies.keys()))
q = PyQuery(r.content)
self.assertEqual(q('div a.active[href="/accounts/settings/full_draft/off"]').contents(), ['Off'])
self.assertEqual(q('div a.active[href="/accounts/settings/new_enough/60"]').contents(), ['60 days'])

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2010, All Rights Reserved
# Copyright The IETF Trust 2010-2019, All Rights Reserved
from django.shortcuts import render
from django.conf import settings
@ -10,7 +10,7 @@ def preferences(request, **kwargs):
new_cookies = {}
del_cookies = []
preferences['defaults'] = settings.USER_PREFERENCE_DEFAULTS
for key in settings.USER_PREFERENCE_DEFAULTS.keys():
for key in list(settings.USER_PREFERENCE_DEFAULTS.keys()):
if key in kwargs:
if kwargs[key] == None:
del_cookies += [key]

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
from django import forms
from django.core.exceptions import ValidationError
from django.template import Context
@ -20,7 +21,7 @@ class DBTemplateForm(forms.ModelForm):
PlainTemplate(content).render(Context({}))
else:
raise ValidationError("Unexpected DBTemplate.type.slug: %s" % self.type.slug)
except Exception, e:
except Exception as e:
raise ValidationError(e)
return content

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
from django.db import migrations
import django.db.models.deletion

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-05 11:39
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-03-13 13:41
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
# Copyright The IETF Trust 2012-2019, All Rights Reserved
from __future__ import unicode_literals, print_function
from django.db import models
@ -41,6 +41,6 @@ class DBTemplate(models.Model):
PlainTemplate(self.content).render(Context({}))
else:
raise ValidationError("Unexpected DBTemplate.type.slug: %s" % self.type.slug)
except Exception, e:
except Exception as e:
raise ValidationError(e)

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
import os
import string
from docutils.core import publish_string
@ -54,7 +55,7 @@ class RSTTemplate(PlainTemplate):
'template': RST_TEMPLATE,
'halt_level': 2,
})
except SystemMessage, e:
except SystemMessage as e:
e.message = e.message.replace('<string>:', 'line ')
args = list(e.args)
args[0] = args[0].replace('<string>:', 'line ')

View file

@ -4,7 +4,7 @@
from django.contrib import admin
from django import forms
from models import (StateType, State, RelatedDocument, DocumentAuthor, Document, RelatedDocHistory,
from .models import (StateType, State, RelatedDocument, DocumentAuthor, Document, RelatedDocHistory,
DocHistoryAuthor, DocHistory, DocAlias, DocReminder, DocEvent, NewRevisionDocEvent,
StateDocEvent, ConsensusDocEvent, BallotType, BallotDocEvent, WriteupDocEvent, LastCallDocEvent,
TelechatDocEvent, BallotPositionDocEvent, ReviewRequestDocEvent, InitialReviewDocEvent,
@ -155,7 +155,7 @@ admin.site.register(EditedAuthorsDocEvent, DocEventAdmin)
class DeletedEventAdmin(admin.ModelAdmin):
list_display = [u'id', 'content_type', 'json', 'by', 'time']
list_display = ['id', 'content_type', 'json', 'by', 'time']
list_filter = ['time']
raw_id_fields = ['content_type', 'by']
admin.site.register(DeletedEvent, DeletedEventAdmin)

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2010-2019, All Rights Reserved
# expiry of Internet Drafts
from django.conf import settings
@ -92,7 +93,7 @@ def send_expire_warning_for_draft(doc):
request = None
if to or cc:
send_mail(request, to, frm,
u"Expiration impending: %s" % doc.file_tag(),
"Expiration impending: %s" % doc.file_tag(),
"doc/draft/expire_warning_email.txt",
dict(doc=doc,
state=state,
@ -112,7 +113,7 @@ def send_expire_notice_for_draft(doc):
(to,cc) = gather_address_lists('doc_expired',doc=doc)
send_mail(request, to,
"I-D Expiring System <ietf-secretariat-reply@ietf.org>",
u"I-D was expired %s" % doc.file_tag(),
"I-D was expired %s" % doc.file_tag(),
"doc/draft/id_expired_email.txt",
dict(doc=doc,
state=state,

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2007, All Rights Reserved
# Copyright The IETF Trust 2007-2019, All Rights Reserved
import datetime
@ -35,7 +35,7 @@ class DocumentChangesFeed(Feed):
return events
def item_title(self, item):
return u"[%s] %s [rev. %s]" % (item.by, truncatewords(strip_tags(item.desc), 15), item.rev)
return "[%s] %s [rev. %s]" % (item.by, truncatewords(strip_tags(item.desc), 15), item.rev)
def item_description(self, item):
return truncatewords_html(format_textarea(item.desc), 20)
@ -44,7 +44,7 @@ class DocumentChangesFeed(Feed):
return item.time
def item_author_name(self, item):
return unicode(item.by)
return str(item.by)
def item_link(self, item):
return urlreverse('ietf.doc.views_doc.document_history', kwargs=dict(name=item.doc.canonical_name())) + "#history-%s" % item.pk
@ -67,7 +67,7 @@ class InLastCallFeed(Feed):
return docs
def item_title(self, item):
return u"%s (%s - %s)" % (item.name,
return "%s (%s - %s)" % (item.name,
datefilter(item.lc_event.time, "F j"),
datefilter(item.lc_event.expires, "F j, Y"))

View file

@ -53,9 +53,9 @@ class SearchableDocumentsField(forms.CharField):
def prepare_value(self, value):
if not value:
value = ""
if isinstance(value, (int, long)):
if isinstance(value, int):
value = str(value)
if isinstance(value, basestring):
if isinstance(value, str):
items = self.parse_select2_value(value)
# accept both names and pks here
names = [ i for i in items if not i.isdigit() ]
@ -79,7 +79,7 @@ class SearchableDocumentsField(forms.CharField):
"model_name": self.model.__name__.lower()
})
return u",".join(unicode(o.pk) for o in value)
return ",".join(str(o.pk) for o in value)
def clean(self, value):
value = super(SearchableDocumentsField, self).clean(value)
@ -90,10 +90,10 @@ class SearchableDocumentsField(forms.CharField):
found_pks = [ str(o.pk) for o in objs ]
failed_pks = [ x for x in pks if x not in found_pks ]
if failed_pks:
raise forms.ValidationError(u"Could not recognize the following documents: {names}. You can only input documents already registered in the Datatracker.".format(names=", ".join(failed_pks)))
raise forms.ValidationError("Could not recognize the following documents: {names}. You can only input documents already registered in the Datatracker.".format(names=", ".join(failed_pks)))
if self.max_entries != None and len(objs) > self.max_entries:
raise forms.ValidationError(u"You can select at most %s entries." % self.max_entries)
raise forms.ValidationError("You can select at most %s entries." % self.max_entries)
return objs

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2017, All Rights Reserved
# Copyright The IETF Trust 2013-2019, All Rights Reserved
from __future__ import unicode_literals
import datetime
import debug #pyflakes:ignore

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2010-2019, All Rights Reserved
# generation of mails
import textwrap, datetime
@ -55,7 +56,7 @@ def email_stream_changed(request, doc, old_stream, new_stream, text=""):
return
if not text:
text = u"Stream changed to <b>%s</b> from %s" % (new_stream, old_stream)
text = "Stream changed to <b>%s</b> from %s" % (new_stream, old_stream)
text = strip_tags(text)
send_mail(request, to, None,
@ -119,8 +120,8 @@ def generate_ballot_writeup(request, doc):
e.by = request.user.person
e.doc = doc
e.rev = doc.rev
e.desc = u"Ballot writeup was generated"
e.text = unicode(render_to_string("doc/mail/ballot_writeup.txt", {'iana': iana}))
e.desc = "Ballot writeup was generated"
e.text = str(render_to_string("doc/mail/ballot_writeup.txt", {'iana': iana}))
# caller is responsible for saving, if necessary
return e
@ -131,8 +132,8 @@ def generate_ballot_rfceditornote(request, doc):
e.by = request.user.person
e.doc = doc
e.rev = doc.rev
e.desc = u"RFC Editor Note for ballot was generated"
e.text = unicode(render_to_string("doc/mail/ballot_rfceditornote.txt"))
e.desc = "RFC Editor Note for ballot was generated"
e.text = str(render_to_string("doc/mail/ballot_rfceditornote.txt"))
e.save()
return e
@ -176,8 +177,8 @@ def generate_last_call_announcement(request, doc):
e.by = request.user.person
e.doc = doc
e.rev = doc.rev
e.desc = u"Last call announcement was generated"
e.text = unicode(mail)
e.desc = "Last call announcement was generated"
e.text = str(mail)
# caller is responsible for saving, if necessary
return e
@ -196,8 +197,8 @@ def generate_approval_mail(request, doc):
e.by = request.user.person
e.doc = doc
e.rev = doc.rev
e.desc = u"Ballot approval text was generated"
e.text = unicode(mail)
e.desc = "Ballot approval text was generated"
e.text = str(mail)
# caller is responsible for saving, if necessary
return e
@ -374,7 +375,7 @@ def generate_issue_ballot_mail(request, doc, ballot):
last_call_has_expired=last_call_has_expired,
needed_ballot_positions=
needed_ballot_positions(doc,
doc.active_ballot().active_ad_positions().values()
list(doc.active_ballot().active_ad_positions().values())
),
)
)
@ -451,7 +452,7 @@ def email_adopted(request, doc, prev_state, new_state, by, comment=""):
state_type = (prev_state or new_state).type
send_mail(request, to, settings.DEFAULT_FROM_EMAIL,
u'The %s %s has placed %s in state "%s"' %
'The %s %s has placed %s in state "%s"' %
(doc.group.acronym.upper(),doc.group.type_id.upper(), doc.name, new_state or "None"),
'doc/mail/doc_adopted_email.txt',
dict(doc=doc,
@ -469,7 +470,7 @@ def email_stream_state_changed(request, doc, prev_state, new_state, by, comment=
state_type = (prev_state or new_state).type
send_mail(request, to, settings.DEFAULT_FROM_EMAIL,
u"%s changed for %s" % (state_type.label, doc.name),
"%s changed for %s" % (state_type.label, doc.name),
'doc/mail/stream_state_changed_email.txt',
dict(doc=doc,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),
@ -485,7 +486,7 @@ def email_stream_tags_changed(request, doc, added_tags, removed_tags, by, commen
(to, cc) = gather_address_lists('doc_stream_state_edited',doc=doc)
send_mail(request, to, settings.DEFAULT_FROM_EMAIL,
u"Tags changed for %s" % doc.name,
"Tags changed for %s" % doc.name,
'doc/mail/stream_tags_changed_email.txt',
dict(doc=doc,
url=settings.IDTRACKER_BASE_URL + doc.get_absolute_url(),

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
import sys
import os
@ -21,7 +22,7 @@ def write(fn, new):
f.close()
class Command(BaseCommand):
help = (u'Generate draft bibxml files, for xml2rfc references')
help = ('Generate draft bibxml files, for xml2rfc references')
def handle(self, *args, **options):
documents = Document.objects.filter(type__slug='draft')

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
import datetime
import django.core.validators

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-04-01 12:31
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-03 11:50
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-03 12:16
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-10-03 06:39
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-04 10:56
from __future__ import unicode_literals
from tqdm import tqdm

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-28 13:11
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.17 on 2018-12-28 13:33
from __future__ import unicode_literals
from django.db import migrations
from django.db.models import F

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-25 13:02
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-11 11:22
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-01 04:43
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-08 08:41
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-08 08:42
from __future__ import unicode_literals
import sys

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-08 10:29
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-28 12:42
from __future__ import unicode_literals
import sys, time

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-08 14:04
from __future__ import unicode_literals
import sys
@ -15,7 +15,7 @@ def forward(apps, schema_editor):
n = getattr(o, a+'_id')
if n:
i = nameid[n]
if not isinstance(i, (int, long)):
if not isinstance(i, int):
raise ValueError("Inappropriate value: %s: nameid[%s]: %s" % (o.__class__.__name__, n, i))
if getattr(o, a+'2_id') != i:
setattr(o, a+'2_id', i)
@ -44,7 +44,7 @@ def forward(apps, schema_editor):
# Document id fixup ------------------------------------------------------------
objs = Document.objects.in_bulk()
nameid = { o.name: o.id for id, o in objs.iteritems() }
nameid = { o.name: o.id for id, o in objs.items() }
sys.stderr.write('\n')
@ -78,7 +78,7 @@ def forward(apps, schema_editor):
sys.stderr.write('\n')
objs = DocAlias.objects.in_bulk()
nameid = { o.name: o.id for id, o in objs.iteritems() }
nameid = { o.name: o.id for id, o in objs.items() }
sys.stderr.write('Setting DocAlias FKs:\n')

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-09 05:46
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-20 09:53
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-21 05:31
from __future__ import unicode_literals
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-21 05:31
from __future__ import unicode_literals
import sys, time

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-05-30 03:36
from __future__ import unicode_literals
from django.db import migrations

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-10 03:47
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-06-10 04:36
from __future__ import unicode_literals
import sys

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2007-2019, All Rights Reserved
# Copyright The IETF Trust 2010-2019, All Rights Reserved
# -*- coding: utf-8 -*-
import datetime
@ -372,7 +372,7 @@ class DocumentInfo(models.Model):
return self.rfc_number()
def author_list(self):
return u", ".join(author.email_id for author in self.documentauthor_set.all() if author.email_id)
return ", ".join(author.email_id for author in self.documentauthor_set.all() if author.email_id)
def authors(self):
return [ a.person for a in self.documentauthor_set.all() ]
@ -531,7 +531,7 @@ class RelatedDocument(models.Model):
def action(self):
return self.relationship.name
def __unicode__(self):
return u"%s %s %s" % (self.source.name, self.relationship.name.lower(), self.target.name)
return "%s %s %s" % (self.source.name, self.relationship.name.lower(), self.target.name)
def is_downref(self):
@ -601,7 +601,7 @@ class DocumentAuthor(DocumentAuthorInfo):
document = ForeignKey('Document')
def __unicode__(self):
return u"%s %s (%s)" % (self.document.name, self.person, self.order)
return "%s %s (%s)" % (self.document.name, self.person, self.order)
validate_docname = RegexValidator(
@ -641,10 +641,10 @@ class Document(DocumentInfo):
return self._cached_absolute_url
def file_tag(self):
return u"<%s>" % self.filename_with_rev()
return "<%s>" % self.filename_with_rev()
def filename_with_rev(self):
return u"%s-%s.txt" % (self.name, self.rev)
return "%s-%s.txt" % (self.name, self.rev)
def latest_event(self, *args, **filter_args):
"""Get latest event of optional Python type and with filter
@ -850,7 +850,7 @@ class RelatedDocHistory(models.Model):
target = ForeignKey('DocAlias', related_name="reversely_related_document_history_set")
relationship = ForeignKey(DocRelationshipName)
def __unicode__(self):
return u"%s %s %s" % (self.source.doc.name, self.relationship.name.lower(), self.target.name)
return "%s %s %s" % (self.source.doc.name, self.relationship.name.lower(), self.target.name)
class DocHistoryAuthor(DocumentAuthorInfo):
# use same naming convention as non-history version to make it a bit
@ -858,7 +858,7 @@ class DocHistoryAuthor(DocumentAuthorInfo):
document = ForeignKey('DocHistory', related_name="documentauthor_set")
def __unicode__(self):
return u"%s %s (%s)" % (self.document.doc.name, self.person, self.order)
return "%s %s (%s)" % (self.document.doc.name, self.person, self.order)
class DocHistory(DocumentInfo):
doc = ForeignKey(Document, related_name="history_set")
@ -869,7 +869,7 @@ class DocHistory(DocumentInfo):
name = models.CharField(max_length=255)
def __unicode__(self):
return unicode(self.doc.name)
return str(self.doc.name)
def canonical_name(self):
if hasattr(self, '_canonical_name'):
@ -918,7 +918,7 @@ class DocAlias(models.Model):
return self.docs.first()
def __unicode__(self):
return "%s-->%s" % (self.name, ','.join([unicode(d.name) for d in self.docs.all() if isinstance(d, Document) ]))
return "%s-->%s" % (self.name, ','.join([str(d.name) for d in self.docs.all() if isinstance(d, Document) ]))
document_link = admin_link("document")
class Meta:
verbose_name = "document alias"
@ -1024,7 +1024,7 @@ class DocEvent(models.Model):
return DocHistory.objects.filter(time__lte=self.time,doc__name=self.doc.name).order_by('-time', '-pk').first()
def __unicode__(self):
return u"%s %s by %s at %s" % (self.doc.name, self.get_type_display().lower(), self.by.plain_name(), self.time)
return "%s %s by %s at %s" % (self.doc.name, self.get_type_display().lower(), self.by.plain_name(), self.time)
def save(self, *args, **kwargs):
super(DocEvent, self).save(*args, **kwargs)
@ -1057,7 +1057,7 @@ class BallotType(models.Model):
positions = models.ManyToManyField(BallotPositionName, blank=True)
def __unicode__(self):
return u"%s: %s" % (self.name, self.doc_type.name)
return "%s: %s" % (self.name, self.doc_type.name)
class Meta:
ordering = ['order']
@ -1184,7 +1184,7 @@ class DeletedEvent(models.Model):
time = models.DateTimeField(default=datetime.datetime.now)
def __unicode__(self):
return u"%s by %s %s" % (self.content_type, self.by, self.time)
return "%s by %s %s" % (self.content_type, self.by, self.time)
class EditedAuthorsDocEvent(DocEvent):
""" Capture the reasoning or authority for changing a document author list.

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2007, All Rights Reserved
# Copyright The IETF Trust 2007-2019, All Rights Reserved
import bleach
import datetime
@ -64,7 +64,7 @@ def parse_email_list(value):
"""
if value and isinstance(value, (types.StringType,types.UnicodeType)): # testing for 'value' being true isn't necessary; it's a fast-out route
if value and isinstance(value, (bytes,str)): # testing for 'value' being true isn't necessary; it's a fast-out route
addrs = re.split(", ?", value)
ret = []
for addr in addrs:
@ -109,7 +109,7 @@ def make_one_per_line(value):
>>> make_one_per_line(None)
"""
if value and isinstance(value, (types.StringType,types.UnicodeType)):
if value and isinstance(value, (bytes,str)):
return re.sub(", ?", "\n", value)
else:
return value
@ -145,7 +145,7 @@ def sanitize(value):
@register.filter(name='bracket')
def square_brackets(value):
"""Adds square brackets around text."""
if isinstance(value, (types.StringType,types.UnicodeType)):
if isinstance(value, (bytes,str)):
if value == "":
value = " "
return "[ %s ]" % value
@ -195,7 +195,7 @@ def rfcnospace(string):
@register.filter
def prettystdname(string):
from ietf.doc.utils import prettify_std_name
return prettify_std_name(unicode(string or ""))
return prettify_std_name(str(string or ""))
@register.filter(name='rfcurl')
def rfclink(string):
@ -338,7 +338,7 @@ def expires_soon(x,request):
@register.filter(name='startswith')
def startswith(x, y):
return unicode(x).startswith(y)
return str(x).startswith(y)
@register.filter
def has_role(user, role_names):
@ -377,14 +377,14 @@ def format_snippet(text, trunc_words=25):
full = keep_spacing(collapsebr(linebreaksbr(mark_safe(sanitize_fragment(text)))))
snippet = truncatewords_html(full, trunc_words)
if snippet != full:
return mark_safe(u'<div class="snippet">%s<button class="btn btn-xs btn-default show-all"><span class="fa fa-caret-down"></span></button></div><div class="hidden full">%s</div>' % (snippet, full))
return mark_safe('<div class="snippet">%s<button class="btn btn-xs btn-default show-all"><span class="fa fa-caret-down"></span></button></div><div class="hidden full">%s</div>' % (snippet, full))
return full
@register.simple_tag
def doc_edit_button(url_name, *args, **kwargs):
"""Given URL name/args/kwargs, looks up the URL just like "url" tag and returns a properly formatted button for the document material tables."""
from django.urls import reverse as urlreverse
return mark_safe(u'<a class="btn btn-default btn-xs" href="%s">Edit</a>' % (urlreverse(url_name, args=args, kwargs=kwargs)))
return mark_safe('<a class="btn btn-default btn-xs" href="%s">Edit</a>' % (urlreverse(url_name, args=args, kwargs=kwargs)))
@register.filter
def textify(text):
@ -419,7 +419,7 @@ if __name__ == "__main__":
_test()
@register.filter
def plural(text, seq, arg=u's'):
def plural(text, seq, arg='s'):
"Similar to pluralize, but looks at the text, too"
from django.template.defaultfilters import pluralize
if text.endswith('s'):
@ -505,9 +505,9 @@ def nbsp(value):
@register.filter()
def comma_separated_list(seq, end_word="and"):
if len(seq) < 2:
return u"".join(seq)
return "".join(seq)
else:
return u", ".join(seq[:-1]) + u" %s %s"%(end_word, seq[-1])
return ", ".join(seq[:-1]) + " %s %s"%(end_word, seq[-1])
@register.filter()
def zaptmp(s):

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2016-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django import template

View file

@ -6,7 +6,7 @@ import shutil
import datetime
import json
import sys
import urlparse
import urllib.parse
import bibtexparser
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
import unittest2 as unittest
@ -14,7 +14,7 @@ else:
import unittest
from pyquery import PyQuery
from tempfile import NamedTemporaryFile
from Cookie import SimpleCookie
from http.cookies import SimpleCookie
from django.urls import reverse as urlreverse
from django.conf import settings
@ -142,71 +142,71 @@ class SearchTests(TestCase):
# exact match
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name=draft.name)))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
# prefix match
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(draft.name.split("-")[:-1]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
# non-prefix match
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(draft.name.split("-")[1:]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
# other doctypes than drafts
doc = Document.objects.get(name='charter-ietf-mars')
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name='charter-ietf-ma')))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
doc = Document.objects.filter(name__startswith='conflict-review-').first()
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(doc.name.split("-")[:-1]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
doc = Document.objects.filter(name__startswith='status-change-').first()
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(doc.name.split("-")[:-1]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
doc = Document.objects.filter(name__startswith='agenda-').first()
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(doc.name.split("-")[:-1]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
doc = Document.objects.filter(name__startswith='minutes-').first()
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(doc.name.split("-")[:-1]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
doc = Document.objects.filter(name__startswith='slides-').first()
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="-".join(doc.name.split("-")[:-1]))))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=doc.name)))
# match with revision
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name=draft.name + "-" + prev_rev)))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=prev_rev)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=prev_rev)))
# match with non-existing revision
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name=draft.name + "-09")))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name)))
# match with revision and extension
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name=draft.name + "-" + prev_rev + ".txt")))
self.assertEqual(r.status_code, 302)
self.assertEqual(urlparse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=prev_rev)))
self.assertEqual(urllib.parse.urlparse(r["Location"]).path, urlreverse("ietf.doc.views_doc.document_main", kwargs=dict(name=draft.name, rev=prev_rev)))
# no match
r = self.client.get(urlreverse('ietf.doc.views_search.search_for_name', kwargs=dict(name="draft-ietf-doesnotexist-42")))
self.assertEqual(r.status_code, 302)
parsed = urlparse.urlparse(r["Location"])
parsed = urllib.parse.urlparse(r["Location"])
self.assertEqual(parsed.path, urlreverse('ietf.doc.views_search.search'))
self.assertEqual(urlparse.parse_qs(parsed.query)["name"][0], "draft-ietf-doesnotexist-42")
self.assertEqual(urllib.parse.parse_qs(parsed.query)["name"][0], "draft-ietf-doesnotexist-42")
def test_frontpage(self):
r = self.client.get("/")
@ -919,11 +919,11 @@ class DocTestCase(TestCase):
url = urlreverse('ietf.doc.views_doc.document_bibtex', kwargs=dict(name=rfc.name))
r = self.client.get(url)
entry = bibtexparser.loads(r.content).get_entry_dict()["rfc%s"%num]
self.assertEqual(entry['series'], u'Request for Comments')
self.assertEqual(entry['series'], 'Request for Comments')
self.assertEqual(entry['number'], num)
self.assertEqual(entry['doi'], u'10.17487/RFC%s'%num)
self.assertEqual(entry['year'], u'2010')
self.assertEqual(entry['month'], u'oct')
self.assertEqual(entry['doi'], '10.17487/RFC%s'%num)
self.assertEqual(entry['year'], '2010')
self.assertEqual(entry['month'], 'oct')
#
self.assertNotIn('day', entry)
@ -931,7 +931,7 @@ class DocTestCase(TestCase):
stream_id = 'rse',
states = [('draft','rfc'),('draft-iesg','pub')],
std_level_id = 'ind',
time = datetime.datetime(1990,04,01),
time = datetime.datetime(1990,0o4,0o1),
)
num = april1.rfc_number()
DocEventFactory.create(doc=april1, type='published_rfc', time = '1990-04-01')
@ -939,20 +939,20 @@ class DocTestCase(TestCase):
url = urlreverse('ietf.doc.views_doc.document_bibtex', kwargs=dict(name=april1.name))
r = self.client.get(url)
entry = bibtexparser.loads(r.content).get_entry_dict()['rfc%s'%num]
self.assertEqual(entry['series'], u'Request for Comments')
self.assertEqual(entry['series'], 'Request for Comments')
self.assertEqual(entry['number'], num)
self.assertEqual(entry['doi'], u'10.17487/RFC%s'%num)
self.assertEqual(entry['year'], u'1990')
self.assertEqual(entry['month'], u'apr')
self.assertEqual(entry['day'], u'1')
self.assertEqual(entry['doi'], '10.17487/RFC%s'%num)
self.assertEqual(entry['year'], '1990')
self.assertEqual(entry['month'], 'apr')
self.assertEqual(entry['day'], '1')
draft = IndividualDraftFactory.create()
docname = u'%s-%s' % (draft.name, draft.rev)
docname = '%s-%s' % (draft.name, draft.rev)
bibname = docname[6:] # drop the 'draft-' prefix
url = urlreverse('ietf.doc.views_doc.document_bibtex', kwargs=dict(name=draft.name))
r = self.client.get(url)
entry = bibtexparser.loads(r.content).get_entry_dict()[bibname]
self.assertEqual(entry['note'], u'Work in Progress')
self.assertEqual(entry['note'], 'Work in Progress')
self.assertEqual(entry['number'], docname)
self.assertEqual(entry['year'], str(draft.pub_date().year))
self.assertEqual(entry['month'], draft.pub_date().strftime('%b').lower())
@ -1012,11 +1012,11 @@ class ReferencesTest(TestCase):
RelatedDocument.objects.get_or_create(source=doc1,target=doc2,relationship=DocRelationshipName.objects.get(slug='refnorm'))
url = urlreverse('ietf.doc.views_doc.document_references', kwargs=dict(name=doc1.name))
r = self.client.get(url)
self.assertEquals(r.status_code, 200)
self.assertEqual(r.status_code, 200)
self.assertTrue(doc2.name in unicontent(r))
url = urlreverse('ietf.doc.views_doc.document_referenced_by', kwargs=dict(name=doc2.name))
r = self.client.get(url)
self.assertEquals(r.status_code, 200)
self.assertEqual(r.status_code, 200)
self.assertTrue(doc1.name in unicontent(r))

View file

@ -540,8 +540,8 @@ class BallotWriteupsTests(TestCase):
e.by = Person.objects.get(name="(System)")
e.doc = draft
e.rev = draft.rev
e.desc = u"Ballot approval text was generated"
e.text = u"Test approval text."
e.desc = "Ballot approval text was generated"
e.text = "Test approval text."
e.save()
events.append(e)
@ -550,8 +550,8 @@ class BallotWriteupsTests(TestCase):
e.by = Person.objects.get(name="(System)")
e.doc = draft
e.rev = draft.rev
e.desc = u"Ballot writeup was generated"
e.text = u"Test ballot writeup text."
e.desc = "Ballot writeup was generated"
e.text = "Test ballot writeup text."
e.save()
events.append(e)
@ -560,8 +560,8 @@ class BallotWriteupsTests(TestCase):
e.by = Person.objects.get(name="(System)")
e.doc = draft
e.rev = draft.rev
e.desc = u"RFC Editor Note for ballot was generated"
e.text = u"Test note to the RFC Editor text."
e.desc = "RFC Editor Note for ballot was generated"
e.text = "Test note to the RFC Editor text."
e.save()
events.append(e)
@ -588,7 +588,7 @@ class BallotWriteupsTests(TestCase):
# RFC Editor Notes for documents in the IRTF Stream
e = DocEvent(doc=draft, rev=draft.rev, by=Person.objects.get(name="(System)"), type='changed_stream')
e.desc = u"Changed stream to <b>%s</b>" % 'irtf'
e.desc = "Changed stream to <b>%s</b>" % 'irtf'
e.save()
draft.stream_id = 'irtf'
@ -603,7 +603,7 @@ class BallotWriteupsTests(TestCase):
# RFC Editor Notes for documents in the IAB Stream
e = DocEvent(doc=draft, rev=draft.rev, by=Person.objects.get(name="(System)"), type='changed_stream')
e.desc = u"Changed stream to <b>%s</b>" % 'ise'
e.desc = "Changed stream to <b>%s</b>" % 'ise'
e.save()
draft.stream_id = 'ise'

View file

@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
# Copyright The IETF Trust 2011, All Rights Reserved
# Copyright The IETF Trust 2011-2019, All Rights Reserved
import os, shutil, datetime
from StringIO import StringIO
from io import StringIO
from pyquery import PyQuery
from django.conf import settings
@ -70,8 +70,8 @@ class EditCharterTests(TestCase):
ames = GroupFactory(acronym='ames',state_id='proposed',list_email='ames-wg@ietf.org',parent=area)
RoleFactory(name_id='ad',group=ames,person=Person.objects.get(user__username='ad'))
RoleFactory(name_id='chair',group=ames,person__name=u'Ames Man',person__user__email='ameschairman@example.org')
RoleFactory(name_id='secr',group=ames,person__name=u'Secretary',person__user__email='amessecretary@example.org')
RoleFactory(name_id='chair',group=ames,person__name='Ames Man',person__user__email='ameschairman@example.org')
RoleFactory(name_id='secr',group=ames,person__name='Secretary',person__user__email='amessecretary@example.org')
CharterFactory(group=ames)
mars = GroupFactory(acronym='mars',parent=area)
@ -591,8 +591,8 @@ class EditCharterTests(TestCase):
RoleFactory(name_id='ad',group=area,person=Person.objects.get(user__username='ad'))
charter = CharterFactory(group__acronym='ames',group__list_email='ames-wg@ietf.org',group__parent=area,group__state_id='bof')
group = charter.group
RoleFactory(name_id='chair',group=group,person__name=u'Ames Man',person__user__email='ameschairman@example.org')
RoleFactory(name_id='secr',group=group,person__name=u'Secretary',person__user__email='amessecretary@example.org')
RoleFactory(name_id='chair',group=group,person__name='Ames Man',person__user__email='ameschairman@example.org')
RoleFactory(name_id='secr',group=group,person__name='Secretary',person__user__email='amessecretary@example.org')
url = urlreverse('ietf.doc.views_charter.approve', kwargs=dict(name=charter.name))
login_testing_unauthorized(self, "secretary", url)

View file

@ -1,10 +1,11 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
# -*- coding: utf-8 -*-
import debug # pyflakes:ignore
import os
import shutil
from pyquery import PyQuery
from StringIO import StringIO
from io import StringIO
from textwrap import wrap
from django.conf import settings
@ -63,9 +64,9 @@ class ConflictReviewTests(TestCase):
self.assertEqual(r.status_code, 302)
review_doc = Document.objects.get(name='conflict-review-imaginary-independent-submission')
self.assertEqual(review_doc.get_state('conflrev').slug,'needshep')
self.assertEqual(review_doc.rev,u'00')
self.assertEqual(review_doc.ad.name,u'Areað Irector')
self.assertEqual(review_doc.notify,u'ipu@ietf.org')
self.assertEqual(review_doc.rev,'00')
self.assertEqual(review_doc.ad.name,'Areað Irector')
self.assertEqual(review_doc.notify,'ipu@ietf.org')
doc = Document.objects.get(name='draft-imaginary-independent-submission')
self.assertTrue(doc in [x.target.document for x in review_doc.relateddocument_set.filter(relationship__slug='conflrev')])
@ -87,34 +88,34 @@ class ConflictReviewTests(TestCase):
# can't start conflict reviews on documents not in a stream
r = self.client.get(url)
self.assertEquals(r.status_code, 404)
self.assertEqual(r.status_code, 404)
# can't start conflict reviews on documents in some other stream
doc.stream = StreamName.objects.get(slug='irtf')
doc.save_with_history([DocEvent.objects.create(doc=doc, rev=doc.rev, type="changed_stream", by=Person.objects.get(user__username="secretary"), desc="Test")])
r = self.client.get(url)
self.assertEquals(r.status_code, 404)
self.assertEqual(r.status_code, 404)
# successful get
doc.stream = StreamName.objects.get(slug='ise')
doc.save_with_history([DocEvent.objects.create(doc=doc, rev=doc.rev, type="changed_stream", by=Person.objects.get(user__username="secretary"), desc="Test")])
r = self.client.get(url)
self.assertEquals(r.status_code, 200)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEquals(len(q('form input[name=notify]')),1)
self.assertEquals(len(q('form select[name=ad]')),0)
self.assertEqual(len(q('form input[name=notify]')),1)
self.assertEqual(len(q('form select[name=ad]')),0)
# successfully starts a review, and notifies the secretariat
messages_before = len(outbox)
r = self.client.post(url,dict(notify='ipu@ietf.org'))
self.assertEquals(r.status_code, 302)
self.assertEqual(r.status_code, 302)
review_doc = Document.objects.get(name='conflict-review-imaginary-independent-submission')
self.assertEquals(review_doc.get_state('conflrev').slug,'needshep')
self.assertEquals(review_doc.rev,u'00')
self.assertEquals(review_doc.telechat_date(),None)
self.assertEquals(review_doc.ad.name,u'Ietf Chair')
self.assertEquals(review_doc.notify,u'ipu@ietf.org')
self.assertEqual(review_doc.get_state('conflrev').slug,'needshep')
self.assertEqual(review_doc.rev,'00')
self.assertEqual(review_doc.telechat_date(),None)
self.assertEqual(review_doc.ad.name,'Ietf Chair')
self.assertEqual(review_doc.notify,'ipu@ietf.org')
doc = Document.objects.get(name='draft-imaginary-independent-submission')
self.assertTrue(doc in [x.target.document for x in review_doc.relateddocument_set.filter(relationship__slug='conflrev')])
@ -297,9 +298,9 @@ class ConflictReviewTests(TestCase):
self.assertIn('ietf-announce@', outbox[0]['Cc'])
self.assertIn('iana@', outbox[0]['Cc'])
if approve_type == 'appr-noprob':
self.assertIn( 'IESG has no problem', ''.join(wrap(unicode(outbox[0]),2**16)))
self.assertIn( 'IESG has no problem', ''.join(wrap(str(outbox[0]),2**16)))
else:
self.assertIn( 'NOT be published', ''.join(wrap(unicode(outbox[0]),2**16)))
self.assertIn( 'NOT be published', ''.join(wrap(str(outbox[0]),2**16)))
def test_approve_reqnopub(self):
@ -330,12 +331,12 @@ class ConflictReviewSubmitTests(TestCase):
# sane post using textbox
path = os.path.join(settings.CONFLICT_REVIEW_PATH, '%s-%s.txt' % (doc.canonical_name(), doc.rev))
self.assertEqual(doc.rev,u'00')
self.assertEqual(doc.rev,'00')
self.assertFalse(os.path.exists(path))
r = self.client.post(url,dict(content="Some initial review text\n",submit_response="1"))
self.assertEqual(r.status_code,302)
doc = Document.objects.get(name='conflict-review-imaginary-irtf-submission')
self.assertEqual(doc.rev,u'00')
self.assertEqual(doc.rev,'00')
with open(path) as f:
self.assertEqual(f.read(),"Some initial review text\n")
f.close()
@ -348,7 +349,7 @@ class ConflictReviewSubmitTests(TestCase):
# A little additional setup
# doc.rev is u'00' per the test setup - double-checking that here - if it fails, the breakage is in setUp
self.assertEqual(doc.rev,u'00')
self.assertEqual(doc.rev,'00')
path = os.path.join(settings.CONFLICT_REVIEW_PATH, '%s-%s.txt' % (doc.canonical_name(), doc.rev))
with open(path,'w') as f:
f.write('This is the old proposal.')
@ -375,7 +376,7 @@ class ConflictReviewSubmitTests(TestCase):
r = self.client.post(url,dict(txt=test_file,submit_response="1"))
self.assertEqual(r.status_code, 302)
doc = Document.objects.get(name='conflict-review-imaginary-irtf-submission')
self.assertEqual(doc.rev,u'01')
self.assertEqual(doc.rev,'01')
path = os.path.join(settings.CONFLICT_REVIEW_PATH, '%s-%s.txt' % (doc.canonical_name(), doc.rev))
with open(path) as f:
self.assertEqual(f.read(),"This is a new proposal.")

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2017-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.urls import reverse as urlreverse
from pyquery import PyQuery

View file

@ -4,7 +4,7 @@
import os
import shutil
import datetime
import StringIO
import io
from pyquery import PyQuery
from collections import Counter
@ -458,7 +458,7 @@ class EditInfoTests(TestCase):
# reset
e = DocEvent(doc=draft, rev=draft.rev, by=Person.objects.get(name="(System)"), type='changed_document')
e.desc = u"Intended Status changed to <b>%s</b> from %s"% (draft.intended_std_level_id, 'bcp')
e.desc = "Intended Status changed to <b>%s</b> from %s"% (draft.intended_std_level_id, 'bcp')
e.save()
draft.intended_std_level_id = 'bcp'
@ -467,7 +467,7 @@ class EditInfoTests(TestCase):
self.assertEqual(r.status_code, 403) # BCPs must have a consensus
e = DocEvent(doc=draft, rev=draft.rev, by=Person.objects.get(name="(System)"), type='changed_document')
e.desc = u"Intended Status changed to <b>%s</b> from %s"% (draft.intended_std_level_id, 'inf')
e.desc = "Intended Status changed to <b>%s</b> from %s"% (draft.intended_std_level_id, 'inf')
e.save()
draft.intended_std_level_id = 'inf'
@ -774,7 +774,7 @@ class ExpireLastCallTests(TestCase):
class IndividualInfoFormsTests(TestCase):
def setUp(self):
doc = WgDraftFactory(group__acronym='mars',shepherd=PersonFactory(user__username='plain',name=u'Plain Man').email_set.first())
doc = WgDraftFactory(group__acronym='mars',shepherd=PersonFactory(user__username='plain',name='Plain Man').email_set.first())
self.docname = doc.name
def test_doc_change_stream(self):
@ -1056,7 +1056,7 @@ class IndividualInfoFormsTests(TestCase):
self.assertTrue(doc.latest_event(WriteupDocEvent,type="changed_protocol_writeup").text.startswith('here is a new writeup'))
# file upload
test_file = StringIO.StringIO("This is a different writeup.")
test_file = io.StringIO("This is a different writeup.")
test_file.name = "unnamed"
r = self.client.post(url,dict(txt=test_file,submit_response="1"))
self.assertEqual(r.status_code, 302)
@ -1362,7 +1362,7 @@ class AdoptDraftTests(TestCase):
class ChangeStreamStateTests(TestCase):
def test_set_tags(self):
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name=u'WG Cháir Man')
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name='WG Cháir Man')
RoleFactory(name_id='delegate',group=role.group,person__user__email='marsdelegate@example.org')
draft = WgDraftFactory(group=role.group,shepherd=PersonFactory(user__username='plain',user__email='plain@example.com').email_set.first())
draft.tags.set(DocTagName.objects.filter(slug="w-expert"))
@ -1399,12 +1399,12 @@ class ChangeStreamStateTests(TestCase):
self.assertEqual(draft.docevent_set.count() - events_before, 2)
self.assertEqual(len(outbox), mailbox_before + 1)
self.assertTrue("tags changed" in outbox[-1]["Subject"].lower())
self.assertTrue("mars-chairs@ietf.org" in unicode(outbox[-1]))
self.assertTrue("marsdelegate@example.org" in unicode(outbox[-1]))
self.assertTrue("plain@example.com" in unicode(outbox[-1]))
self.assertTrue("mars-chairs@ietf.org" in str(outbox[-1]))
self.assertTrue("marsdelegate@example.org" in str(outbox[-1]))
self.assertTrue("plain@example.com" in str(outbox[-1]))
def test_set_initial_state(self):
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name=u'WG Cháir Man')
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name='WG Cháir Man')
RoleFactory(name_id='delegate',group=role.group,person__user__email='marsdelegate@ietf.org')
draft = WgDraftFactory(group=role.group)
draft.states.all().delete()
@ -1436,11 +1436,11 @@ class ChangeStreamStateTests(TestCase):
self.assertTrue(due - datetime.timedelta(days=1) <= reminder[0].due <= due + datetime.timedelta(days=1))
self.assertEqual(len(outbox), 1)
self.assertTrue("state changed" in outbox[0]["Subject"].lower())
self.assertTrue("mars-chairs@ietf.org" in unicode(outbox[0]))
self.assertTrue("marsdelegate@ietf.org" in unicode(outbox[0]))
self.assertTrue("mars-chairs@ietf.org" in str(outbox[0]))
self.assertTrue("marsdelegate@ietf.org" in str(outbox[0]))
def test_set_state(self):
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name=u'WG Cháir Man')
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name='WG Cháir Man')
RoleFactory(name_id='delegate',group=role.group,person__user__email='marsdelegate@ietf.org')
draft = WgDraftFactory(group=role.group)
@ -1481,11 +1481,11 @@ class ChangeStreamStateTests(TestCase):
self.assertTrue(due - datetime.timedelta(days=1) <= reminder[0].due <= due + datetime.timedelta(days=1))
self.assertEqual(len(outbox), 1)
self.assertTrue("state changed" in outbox[0]["Subject"].lower())
self.assertTrue("mars-chairs@ietf.org" in unicode(outbox[0]))
self.assertTrue("marsdelegate@ietf.org" in unicode(outbox[0]))
self.assertTrue("mars-chairs@ietf.org" in str(outbox[0]))
self.assertTrue("marsdelegate@ietf.org" in str(outbox[0]))
def test_pubreq_validation(self):
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name=u'WG Cháir Man')
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name='WG Cháir Man')
RoleFactory(name_id='delegate',group=role.group,person__user__email='marsdelegate@ietf.org')
draft = WgDraftFactory(group=role.group)
@ -1509,7 +1509,7 @@ class ChangeStreamStateTests(TestCase):
class ChangeReplacesTests(TestCase):
def setUp(self):
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name=u'WG Cháir Man')
role = RoleFactory(name_id='chair',group__acronym='mars',group__list_email='mars-wg@ietf.org',person__user__username='marschairman',person__name='WG Cháir Man')
RoleFactory(name_id='delegate',group=role.group,person__user__email='marsdelegate@ietf.org')
#draft = WgDraftFactory(group=role.group)
@ -1520,7 +1520,7 @@ class ChangeReplacesTests(TestCase):
title="Base A",
group=mars_wg,
)
p = PersonFactory(name=u"basea_author")
p = PersonFactory(name="basea_author")
e = Email.objects.create(address="basea_author@example.com", person=p, origin=p.user.username)
self.basea.documentauthor_set.create(person=p, email=e, order=1)
@ -1530,7 +1530,7 @@ class ChangeReplacesTests(TestCase):
group=mars_wg,
expires = datetime.datetime.now() - datetime.timedelta(days = 365 - settings.INTERNET_DRAFT_DAYS_TO_EXPIRE),
)
p = PersonFactory(name=u"baseb_author")
p = PersonFactory(name="baseb_author")
e = Email.objects.create(address="baseb_author@example.com", person=p, origin=p.user.username)
self.baseb.documentauthor_set.create(person=p, email=e, order=1)
@ -1539,7 +1539,7 @@ class ChangeReplacesTests(TestCase):
title="Replace Base A",
group=mars_wg,
)
p = PersonFactory(name=u"replacea_author")
p = PersonFactory(name="replacea_author")
e = Email.objects.create(address="replacea_author@example.com", person=p, origin=p.user.username)
self.replacea.documentauthor_set.create(person=p, email=e, order=1)
@ -1548,7 +1548,7 @@ class ChangeReplacesTests(TestCase):
title="Replace Base A and Base B",
group=mars_wg,
)
p = PersonFactory(name=u"replaceboth_author")
p = PersonFactory(name="replaceboth_author")
e = Email.objects.create(address="replaceboth_author@example.com", person=p, origin=p.user.username)
self.replaceboth.documentauthor_set.create(person=p, email=e, order=1)
@ -1627,15 +1627,15 @@ class ChangeReplacesTests(TestCase):
login_testing_unauthorized(self, "secretary", url)
r = self.client.get(url)
self.assertEquals(r.status_code, 200)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEquals(len(q('form[name=review-suggested-replaces]')), 1)
self.assertEqual(len(q('form[name=review-suggested-replaces]')), 1)
r = self.client.post(url, dict(replaces=[replaced.pk]))
self.assertEquals(r.status_code, 302)
self.assertEqual(r.status_code, 302)
self.assertTrue(not self.replacea.related_that_doc("possibly-replaces"))
self.assertEqual(len(self.replacea.related_that_doc("replaces")), 1)
self.assertEquals(Document.objects.get(pk=self.basea.pk).get_state().slug, 'repl')
self.assertEqual(Document.objects.get(pk=self.basea.pk).get_state().slug, 'repl')
class MoreReplacesTests(TestCase):

View file

@ -1,10 +1,10 @@
# Copyright The IETF Trust 2011-2019, All Rights Reserved
# Copyright The IETF Trust 2014-2019, All Rights Reserved
# -*- coding: utf-8 -*-
import os
import shutil
import datetime
from StringIO import StringIO
from io import StringIO
from pyquery import PyQuery
import debug # pyflakes:ignore

View file

@ -5,7 +5,7 @@ import datetime, os, shutil, json
import tarfile, tempfile, mailbox
import email.mime.multipart, email.mime.text, email.utils
from StringIO import StringIO
from io import StringIO
from mock import patch
from requests import Response
@ -311,8 +311,8 @@ class ReviewTests(TestCase):
def test_assign_reviewer(self):
doc = WgDraftFactory(pages=2)
review_team = ReviewTeamFactory(acronym="reviewteam", name="Review Team", type_id="review", list_email="reviewteam@ietf.org", parent=Group.objects.get(acronym="farfut"))
rev_role = RoleFactory(group=review_team,person__user__username='reviewer',person__user__email='reviewer@example.com',person__name=u'Some Reviewer',name_id='reviewer')
RoleFactory(group=review_team,person__user__username='marschairman',person__name=u'WG Cháir Man',name_id='reviewer')
rev_role = RoleFactory(group=review_team,person__user__username='reviewer',person__user__email='reviewer@example.com',person__name='Some Reviewer',name_id='reviewer')
RoleFactory(group=review_team,person__user__username='marschairman',person__name='WG Cháir Man',name_id='reviewer')
RoleFactory(group=review_team,person__user__username='reviewsecretary',person__user__email='reviewsecretary@example.com',name_id='secr')
ReviewerSettings.objects.create(team=review_team, person=rev_role.person, min_interval=14, skip_next=0)
@ -353,7 +353,7 @@ class ReviewTests(TestCase):
reviewer_settings.save()
# Need one more person in review team one so we can test incrementing skip_count without immediately decrementing it
another_reviewer = PersonFactory.create(name = u"Extra TestReviewer") # needs to be lexically greater than the existing one
another_reviewer = PersonFactory.create(name = "Extra TestReviewer") # needs to be lexically greater than the existing one
another_reviewer.role_set.create(name_id='reviewer', email=another_reviewer.email(), group=review_req.team)
UnavailablePeriod.objects.create(
@ -462,7 +462,7 @@ class ReviewTests(TestCase):
login_testing_unauthorized(self, "reviewsecretary", reject_url)
r = self.client.get(reject_url)
self.assertEqual(r.status_code, 200)
self.assertTrue(unicode(assignment.reviewer.person) in unicontent(r))
self.assertTrue(str(assignment.reviewer.person) in unicontent(r))
# reject
empty_outbox()

View file

@ -7,7 +7,7 @@ import shutil
import debug # pyflakes:ignore
from pyquery import PyQuery
from StringIO import StringIO
from io import StringIO
from textwrap import wrap
from django.conf import settings
@ -73,9 +73,9 @@ class StatusChangeTests(TestCase):
self.assertEqual(r.status_code, 302)
status_change = Document.objects.get(name='status-change-imaginary-new')
self.assertEqual(status_change.get_state('statchg').slug,'adrev')
self.assertEqual(status_change.rev,u'00')
self.assertEqual(status_change.ad.name,u'Areað Irector')
self.assertEqual(status_change.notify,u'ipu@ietf.org')
self.assertEqual(status_change.rev,'00')
self.assertEqual(status_change.ad.name,'Areað Irector')
self.assertEqual(status_change.notify,'ipu@ietf.org')
self.assertTrue(status_change.relateddocument_set.filter(relationship__slug='tois',target__docs__name='draft-ietf-random-thing'))
def test_change_state(self):
@ -112,10 +112,10 @@ class StatusChangeTests(TestCase):
doc.save_with_history([DocEvent.objects.create(doc=doc, rev=doc.rev, type="changed_document", by=Person.objects.get(user__username="secretary"), desc="Test")])
lc_req_pk = str(State.objects.get(slug='lc-req',type__slug='statchg').pk)
r = self.client.post(url,dict(new_state=lc_req_pk))
self.assertEquals(r.status_code, 200)
self.assertEqual(r.status_code, 200)
doc = Document.objects.get(name='status-change-imaginary-mid-review')
self.assertEquals(doc.get_state('statchg').slug,'lc-req')
self.assertEquals(len(outbox), messages_before + 1)
self.assertEqual(doc.get_state('statchg').slug,'lc-req')
self.assertEqual(len(outbox), messages_before + 1)
self.assertTrue('Last Call:' in outbox[-1]['Subject'])
# successful change to IESG Evaluation
@ -171,15 +171,15 @@ class StatusChangeTests(TestCase):
# normal get
r = self.client.get(url)
self.assertEquals(r.status_code, 200)
self.assertEqual(r.status_code, 200)
q = PyQuery(r.content)
self.assertEquals(len(q('input[name=title]')),1)
self.assertEqual(len(q('input[name=title]')),1)
# change title
r = self.client.post(url,dict(title='New title'))
self.assertEquals(r.status_code,302)
self.assertEqual(r.status_code,302)
doc = Document.objects.get(name='status-change-imaginary-mid-review')
self.assertEquals(doc.title,'New title')
self.assertEqual(doc.title,'New title')
self.assertTrue(doc.latest_event(DocEvent,type="added_comment").desc.startswith('Title changed'))
def test_edit_ad(self):
@ -288,7 +288,7 @@ class StatusChangeTests(TestCase):
self.assertTrue( 'Last call requested' in ''.join(wrap(r.content,2**16)))
self.assertEqual(len(outbox), messages_before + 1)
self.assertTrue('Last Call:' in outbox[-1]['Subject'])
self.assertTrue('Last Call Request has been submitted' in ''.join(wrap(unicode(outbox[-1]),2**16)))
self.assertTrue('Last Call Request has been submitted' in ''.join(wrap(str(outbox[-1]),2**16)))
def test_approve(self):
@ -328,8 +328,8 @@ class StatusChangeTests(TestCase):
self.assertTrue('Action:' in outbox[-1]['Subject'])
self.assertTrue('ietf-announce' in outbox[-1]['To'])
self.assertTrue('rfc-editor' in outbox[-1]['Cc'])
self.assertTrue('(rfc9998) to Historic' in ''.join(wrap(unicode(outbox[-1])+unicode(outbox[-2]),2**16)))
self.assertTrue('(rfc9999) to Internet Standard' in ''.join(wrap(unicode(outbox[-1])+unicode(outbox[-2]),2**16)))
self.assertTrue('(rfc9998) to Historic' in ''.join(wrap(str(outbox[-1])+str(outbox[-2]),2**16)))
self.assertTrue('(rfc9999) to Internet Standard' in ''.join(wrap(str(outbox[-1])+str(outbox[-2]),2**16)))
self.assertTrue(doc.latest_event(DocEvent,type="added_comment").desc.startswith('The following approval message was sent'))
@ -415,12 +415,12 @@ class StatusChangeSubmitTests(TestCase):
# sane post using textbox
path = os.path.join(settings.STATUS_CHANGE_PATH, '%s-%s.txt' % (doc.canonical_name(), doc.rev))
self.assertEqual(doc.rev,u'00')
self.assertEqual(doc.rev,'00')
self.assertFalse(os.path.exists(path))
r = self.client.post(url,dict(content="Some initial review text\n",submit_response="1"))
self.assertEqual(r.status_code,302)
doc = Document.objects.get(name='status-change-imaginary-mid-review')
self.assertEqual(doc.rev,u'00')
self.assertEqual(doc.rev,'00')
with open(path) as f:
self.assertEqual(f.read(),"Some initial review text\n")
self.assertTrue( "mid-review-00" in doc.latest_event(NewRevisionDocEvent).desc)
@ -432,7 +432,7 @@ class StatusChangeSubmitTests(TestCase):
# A little additional setup
# doc.rev is u'00' per the test setup - double-checking that here - if it fails, the breakage is in setUp
self.assertEqual(doc.rev,u'00')
self.assertEqual(doc.rev,'00')
path = os.path.join(settings.STATUS_CHANGE_PATH, '%s-%s.txt' % (doc.canonical_name(), doc.rev))
with open(path,'w') as f:
f.write('This is the old proposal.')
@ -464,7 +464,7 @@ class StatusChangeSubmitTests(TestCase):
r = self.client.post(url,dict(txt=test_file,submit_response="1"))
self.assertEqual(r.status_code, 302)
doc = Document.objects.get(name='status-change-imaginary-mid-review')
self.assertEqual(doc.rev,u'01')
self.assertEqual(doc.rev,'01')
path = os.path.join(settings.STATUS_CHANGE_PATH, '%s-%s.txt' % (doc.canonical_name(), doc.rev))
with open(path) as f:
self.assertEqual(f.read(),"This is a new proposal.")

View file

@ -3,7 +3,7 @@
import os
import re
import urllib
import urllib.request, urllib.parse, urllib.error
import math
import datetime
import hashlib
@ -56,7 +56,7 @@ def save_document_in_history(doc):
def transfer_fields(obj, HistModel):
mfields = get_model_fields_as_dict(item)
# map doc -> dochist
for k, v in mfields.iteritems():
for k, v in mfields.items():
if v == doc:
mfields[k] = dochist
HistModel.objects.create(**mfields)
@ -209,7 +209,7 @@ def create_ballot(request, doc, by, ballot_slug, time=None):
else:
e = BallotDocEvent(type="created_ballot", by=by, doc=doc, rev=doc.rev)
e.ballot_type = BallotType.objects.get(doc_type=doc.type, slug=ballot_slug)
e.desc = u'Created "%s" ballot' % e.ballot_type.name
e.desc = 'Created "%s" ballot' % e.ballot_type.name
e.save()
def create_ballot_if_not_open(request, doc, by, ballot_slug, time=None):
@ -220,7 +220,7 @@ def create_ballot_if_not_open(request, doc, by, ballot_slug, time=None):
else:
e = BallotDocEvent(type="created_ballot", by=by, doc=doc, rev=doc.rev)
e.ballot_type = ballot_type
e.desc = u'Created "%s" ballot' % e.ballot_type.name
e.desc = 'Created "%s" ballot' % e.ballot_type.name
e.save()
return e
else:
@ -313,7 +313,7 @@ def add_links_in_new_revision_events(doc, events, diff_revisions):
links += ""
if prev != None:
links += ' (<a href="%s?url1=%s&url2=%s">diff from previous</a>)' % (settings.RFCDIFF_BASE_URL, urllib.quote(prev, safe="~"), urllib.quote(diff_url, safe="~"))
links += ' (<a href="%s?url1=%s&url2=%s">diff from previous</a>)' % (settings.RFCDIFF_BASE_URL, urllib.parse.quote(prev, safe="~"), urllib.parse.quote(diff_url, safe="~"))
# replace the bold filename part
e.desc = re.sub(r"<b>(.+-[0-9][0-9].txt)</b>", links, e.desc)
@ -363,7 +363,7 @@ def get_document_content(key, filename, split=True, markup=True):
return text.decode(raw_content)
def tags_suffix(tags):
return (u"::" + u"::".join(t.name for t in tags)) if tags else u""
return ("::" + "::".join(t.name for t in tags)) if tags else ""
def add_state_change_event(doc, by, prev_state, new_state, prev_tags=[], new_tags=[], timestamp=None):
"""Add doc event to explain that state change just happened."""
@ -551,7 +551,7 @@ def rebuild_reference_relations(doc,filename=None):
warnings = []
errors = []
unfound = set()
for ( ref, refType ) in refs.iteritems():
for ( ref, refType ) in refs.items():
refdoc = DocAlias.objects.filter( name=ref )
count = refdoc.count()
if count == 0:
@ -587,9 +587,9 @@ def set_replaces_for_document(request, doc, new_replaces, by, email_subject, com
events = []
e = DocEvent(doc=doc, rev=doc.rev, by=by, type='changed_document')
new_replaces_names = u", ".join(d.name for d in new_replaces) or u"None"
old_replaces_names = u", ".join(d.name for d in old_replaces) or u"None"
e.desc = u"This document now replaces <b>%s</b> instead of %s" % (new_replaces_names, old_replaces_names)
new_replaces_names = ", ".join(d.name for d in new_replaces) or "None"
old_replaces_names = ", ".join(d.name for d in old_replaces) or "None"
e.desc = "This document now replaces <b>%s</b> instead of %s" % (new_replaces_names, old_replaces_names)
e.save()
events.append(e)
@ -661,7 +661,7 @@ def get_initial_notify(doc,extra=None):
receivers = []
if extra:
if isinstance(extra,basestring):
if isinstance(extra,str):
extra = extra.split(', ')
receivers.extend(extra)
@ -759,14 +759,14 @@ def make_rev_history(doc):
}
if hasattr(e, 'newrevisiondocevent') and doc.history_set.filter(rev=e.newrevisiondocevent.rev).exists():
history[url]['pages'] = doc.history_set.filter(rev=e.newrevisiondocevent.rev).first().pages
history = history.values()
history = list(history.values())
return sorted(history, key=lambda x: x['published'])
def get_search_cache_key(params):
from ietf.doc.views_search import SearchForm
fields = set(SearchForm.base_fields) - set(['sort',])
kwargs = dict([ (k,v) for (k,v) in params.items() if k in fields ])
kwargs = dict([ (k,v) for (k,v) in list(params.items()) if k in fields ])
key = "doc:document:search:" + hashlib.sha512(json.dumps(kwargs, sort_keys=True)).hexdigest()
return key

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2011-2019, All Rights Reserved
import re, datetime, os, shutil
from django.conf import settings
@ -140,8 +141,8 @@ def generate_ballot_writeup(request, doc):
e.by = request.user.person
e.doc = doc
e.rev = doc.rev,
e.desc = u"Ballot writeup was generated"
e.text = unicode(render_to_string("doc/charter/ballot_writeup.txt"))
e.desc = "Ballot writeup was generated"
e.text = str(render_to_string("doc/charter/ballot_writeup.txt"))
# caller is responsible for saving, if necessary
return e

View file

@ -16,9 +16,9 @@ def wrap_value(v):
def fill_in_telechat_date(docs, doc_dict=None, doc_ids=None):
if doc_dict is None:
doc_dict = dict((d.pk, d) for d in docs)
doc_ids = doc_dict.keys()
doc_ids = list(doc_dict.keys())
if doc_ids is None:
doc_ids = doc_dict.keys()
doc_ids = list(doc_dict.keys())
seen = set()
for e in TelechatDocEvent.objects.filter(doc__id__in=doc_ids, type="scheduled_for_telechat").order_by('-time'):
@ -36,7 +36,7 @@ def fill_in_document_sessions(docs, doc_dict, doc_ids):
# get presentations
presentations = SessionPresentation.objects.filter(session_id__in=[ s.id for s in sessions ])
session_list = [ (p.document_id, p.session) for p in presentations ]
for d in doc_dict.values():
for d in list(doc_dict.values()):
d.sessions = []
for (i, s) in session_list:
if i in doc_ids:
@ -48,7 +48,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
# TODO - this function evolved from something that assumed it was handling only drafts. It still has places where it assumes all docs are drafts where that is not a correct assumption
doc_dict = dict((d.pk, d) for d in docs)
doc_ids = doc_dict.keys()
doc_ids = list(doc_dict.keys())
rfc_aliases = dict([ (a.document.id, a.name) for a in DocAlias.objects.filter(name__startswith="rfc", docs__id__in=doc_ids) ])
@ -112,7 +112,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
# RFCs
# errata
erratas = set(Document.objects.filter(tags="errata", name__in=rfc_aliases.keys()).distinct().values_list("name", flat=True))
erratas = set(Document.objects.filter(tags="errata", name__in=list(rfc_aliases.keys())).distinct().values_list("name", flat=True))
for d in docs:
d.has_errata = d.name in erratas
@ -122,7 +122,7 @@ def fill_in_document_table_attributes(docs, have_telechat_date=False):
d.obsoleted_by_list = []
d.updated_by_list = []
xed_by = RelatedDocument.objects.filter(target__name__in=rfc_aliases.values(),
xed_by = RelatedDocument.objects.filter(target__name__in=list(rfc_aliases.values()),
relationship__in=("obs", "updates")).select_related('target')
rel_rfc_aliases = dict([ (a.document.id, a.name) for a in DocAlias.objects.filter(name__startswith="rfc", docs__id__in=[rel.source_id for rel in xed_by]) ])
for rel in xed_by:

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2010-2019, All Rights Reserved
# ballot management (voting, commenting, writeups, ...) for Area
# Directors and Secretariat
@ -162,17 +163,17 @@ def save_position(form, doc, ballot, ad, login=None, send_email=False):
# figure out a description
if not old_pos and pos.pos.slug != "norecord":
pos.desc = u"[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
pos.desc = "[Ballot Position Update] New position, %s, has been recorded for %s" % (pos.pos.name, pos.ad.plain_name())
elif old_pos and pos.pos != old_pos.pos:
pos.desc = "[Ballot Position Update] Position for %s has been changed to %s from %s" % (pos.ad.plain_name(), pos.pos.name, old_pos.pos.name)
if not pos.desc and changes:
pos.desc = u"Ballot %s text updated for %s" % (u" and ".join(changes), ad.plain_name())
pos.desc = "Ballot %s text updated for %s" % (" and ".join(changes), ad.plain_name())
# only add new event if we actually got a change
if pos.desc:
if login != ad:
pos.desc += u" by %s" % login.plain_name()
pos.desc += " by %s" % login.plain_name()
pos.save()
@ -362,7 +363,7 @@ def send_ballot_comment(request, name, ballot_id):
if extra_cc:
cc.extend(extra_cc)
send_mail_text(request, addrs.to, frm, subject, body, cc=u", ".join(cc))
send_mail_text(request, addrs.to, frm, subject, body, cc=", ".join(cc))
return HttpResponseRedirect(return_to_url)

View file

@ -808,7 +808,7 @@ def charter_with_milestones_txt(request, name, rev):
try:
with open(os.path.join(settings.CHARTER_PATH, filename), 'r') as f:
charter_text = unicode(f.read(), errors='ignore')
charter_text = str(f.read(), errors='ignore')
except IOError:
charter_text = "Error reading charter text %s" % filename

View file

@ -468,7 +468,7 @@ def start_review_as_secretariat(request, name):
notify_addresses = build_notify_addresses(doc_to_review)
init = {
"ad" : Role.objects.filter(group__acronym='ietf',name='chair')[0].person.id,
"notify" : u', '.join(notify_addresses),
"notify" : ', '.join(notify_addresses),
}
form = StartReviewForm(initial=init)
@ -502,7 +502,7 @@ def start_review_as_stream_owner(request, name):
notify_addresses = build_notify_addresses(doc_to_review)
init = {
"notify" : u', '.join(notify_addresses),
"notify" : ', '.join(notify_addresses),
}
form = SimpleStartReviewForm(initial=init)

View file

@ -1,4 +1,4 @@
# Copyright The IETF Trust 2016-2019, All Rights Reserved
# Copyright The IETF Trust 2009-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Parts Copyright (C) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
@ -33,7 +33,7 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import os, datetime, urllib, json, glob, re
import os, datetime, urllib.request, urllib.parse, urllib.error, json, glob, re
from django.http import HttpResponse, Http404 , HttpResponseForbidden
from django.shortcuts import render, get_object_or_404, redirect
@ -251,7 +251,7 @@ def document_main(request, name, rev=None):
if iesg_state and iesg_state.slug in IESG_BALLOT_ACTIVE_STATES:
active_ballot = doc.active_ballot()
if active_ballot:
ballot_summary = needed_ballot_positions(doc, active_ballot.active_ad_positions().values())
ballot_summary = needed_ballot_positions(doc, list(active_ballot.active_ad_positions().values()))
# submission
submission = ""
@ -312,7 +312,7 @@ def document_main(request, name, rev=None):
if doc.stream_id == "ietf" and group.type_id == "wg" and group.list_archive:
search_archive = group.list_archive
search_archive = urllib.quote(search_archive, safe="~")
search_archive = urllib.parse.quote(search_archive, safe="~")
# conflict reviews
conflict_reviews = [d.document.name for d in doc.related_that("conflrev")]
@ -458,7 +458,7 @@ def document_main(request, name, rev=None):
if doc.get_state_slug() in ("intrev", "iesgrev"):
active_ballot = doc.active_ballot()
if active_ballot:
ballot_summary = needed_ballot_positions(doc, active_ballot.active_ad_positions().values())
ballot_summary = needed_ballot_positions(doc, list(active_ballot.active_ad_positions().values()))
else:
ballot_summary = "No active ballot found."
@ -493,14 +493,14 @@ def document_main(request, name, rev=None):
if doc.rev == "00" and not os.path.isfile(pathname):
# This could move to a template
content = u"A conflict review response has not yet been proposed."
content = "A conflict review response has not yet been proposed."
else:
content = doc.text_or_error() # pyflakes:ignore
content = markup_txt.markup(content)
ballot_summary = None
if doc.get_state_slug() in ("iesgeval") and doc.active_ballot():
ballot_summary = needed_ballot_positions(doc, doc.active_ballot().active_ad_positions().values())
ballot_summary = needed_ballot_positions(doc, list(doc.active_ballot().active_ad_positions().values()))
return render(request, "doc/document_conflict_review.html",
dict(doc=doc,
@ -521,13 +521,13 @@ def document_main(request, name, rev=None):
if doc.rev == "00" and not os.path.isfile(pathname):
# This could move to a template
content = u"Status change text has not yet been proposed."
content = "Status change text has not yet been proposed."
else:
content = doc.text_or_error() # pyflakes:ignore
ballot_summary = None
if doc.get_state_slug() in ("iesgeval"):
ballot_summary = needed_ballot_positions(doc, doc.active_ballot().active_ad_positions().values())
ballot_summary = needed_ballot_positions(doc, list(doc.active_ballot().active_ad_positions().values()))
if isinstance(doc,Document):
sorted_relations=doc.relateddocument_set.all().order_by('relationship__name')
@ -1263,7 +1263,7 @@ def add_sessionpresentation(request,name):
if doc.group:
sessions = sorted(sessions,key=lambda x:0 if x.group==doc.group else 1)
session_choices = [(s.pk,unicode(s)) for s in sessions]
session_choices = [(s.pk,str(s)) for s in sessions]
if request.method == 'POST':
version_form = VersionForm(request.POST,choices=version_choices)

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2017, All Rights Reserved
# Copyright The IETF Trust 2017-2019, All Rights Reserved
from __future__ import unicode_literals
from django.urls import reverse as urlreverse
from django.http import HttpResponseRedirect

View file

@ -65,10 +65,10 @@ class ChangeStateForm(forms.Form):
prev_tag = prev_tag[0] if prev_tag else None
if state == prev and tag == prev_tag:
self._errors['comment'] = ErrorList([u'State not changed. Comments entered will be lost with no state change. Please go back and use the Add Comment feature on the history tab to add comments without changing state.'])
self._errors['comment'] = ErrorList(['State not changed. Comments entered will be lost with no state change. Please go back and use the Add Comment feature on the history tab to add comments without changing state.'])
if state != '(None)' and state.slug == 'idexists' and tag:
self._errors['substate'] = ErrorList([u'Clear substate before setting the document to the idexists state.'])
self._errors['substate'] = ErrorList(['Clear substate before setting the document to the idexists state.'])
return retclean
@ -268,7 +268,7 @@ def change_stream(request, name):
events = []
e = DocEvent(doc=doc, rev=doc.rev, by=login, type='changed_document')
e.desc = u"Stream changed to <b>%s</b> from %s"% (new_stream, old_stream or "None")
e.desc = "Stream changed to <b>%s</b> from %s"% (new_stream, old_stream or "None")
e.save()
events.append(e)
@ -281,7 +281,7 @@ def change_stream(request, name):
doc.save_with_history(events)
msg = u"\n".join(e.desc for e in events)
msg = "\n".join(e.desc for e in events)
email_stream_changed(request, doc, old_stream, new_stream, msg)
@ -437,7 +437,7 @@ def change_intention(request, name):
events = []
e = DocEvent(doc=doc, rev=doc.rev, by=login, type='changed_document')
e.desc = u"Intended Status changed to <b>%s</b> from %s"% (new_level,old_level)
e.desc = "Intended Status changed to <b>%s</b> from %s"% (new_level,old_level)
e.save()
events.append(e)
@ -459,7 +459,7 @@ def change_intention(request, name):
doc.save_with_history(events)
msg = u"\n".join(e.desc for e in events)
msg = "\n".join(e.desc for e in events)
email_intended_status_changed(request, doc, msg)
@ -719,9 +719,9 @@ def edit_info(request, name):
if r["area"] != doc.group:
if r["area"].type_id == "area":
changes.append(u"Assigned to <b>%s</b>" % r["area"].name)
changes.append("Assigned to <b>%s</b>" % r["area"].name)
else:
changes.append(u"No longer assigned to any area")
changes.append("No longer assigned to any area")
doc.group = r["area"]
for c in changes:
@ -1160,9 +1160,9 @@ def edit_document_urls(request, name):
res = []
for u in urls:
if u.desc:
res.append(u"%s %s (%s)" % (u.tag.slug, u.url, u.desc.strip('()')))
res.append("%s %s (%s)" % (u.tag.slug, u.url, u.desc.strip('()')))
else:
res.append(u"%s %s" % (u.tag.slug, u.url))
res.append("%s %s" % (u.tag.slug, u.url))
return fs.join(res)
doc = get_object_or_404(Document, name=name)
@ -1376,9 +1376,9 @@ def adopt_draft(request, name):
# stream
if doc.stream != new_stream:
e = DocEvent(type="changed_stream", doc=doc, rev=doc.rev, by=by)
e.desc = u"Changed stream to <b>%s</b>" % new_stream.name
e.desc = "Changed stream to <b>%s</b>" % new_stream.name
if doc.stream:
e.desc += u" from %s" % doc.stream.name
e.desc += " from %s" % doc.stream.name
e.save()
events.append(e)
old_stream = doc.stream
@ -1389,7 +1389,7 @@ def adopt_draft(request, name):
# group
if group != doc.group:
e = DocEvent(type="changed_group", doc=doc, rev=doc.rev, by=by)
e.desc = u"Changed group to <b>%s (%s)</b>" % (group.name, group.acronym.upper())
e.desc = "Changed group to <b>%s (%s)</b>" % (group.name, group.acronym.upper())
if doc.group.type_id != "individ":
e.desc += " from %s (%s)" % (doc.group.name, doc.group.acronym.upper())
e.save()
@ -1461,7 +1461,7 @@ def release_draft(request, name):
doc.tags.clear()
e = DocEvent(type="changed_document", doc=doc, rev=doc.rev, by=by)
l = []
l.append(u"Tag%s %s cleared." % (pluralize(existing_tags), ", ".join(t.name for t in existing_tags)))
l.append("Tag%s %s cleared." % (pluralize(existing_tags), ", ".join(t.name for t in existing_tags)))
e.desc = " ".join(l)
e.save()
events.append(e)
@ -1487,7 +1487,7 @@ def release_draft(request, name):
if doc.stream:
e = DocEvent(type="changed_stream", doc=doc, rev=doc.rev, by=by)
e.desc = u"Changed stream to <b>None</b> from %s" % doc.stream.name
e.desc = "Changed stream to <b>None</b> from %s" % doc.stream.name
e.save()
events.append(e)
old_stream = doc.stream
@ -1529,9 +1529,9 @@ class ChangeStreamStateForm(forms.Form):
f.label = state_type.label
if self.stream.slug == 'ietf':
if self.can_set_sub_pub:
f.help_text = u"Only select 'Submitted to IESG for Publication' to correct errors. Use the document's main page to request publication."
f.help_text = "Only select 'Submitted to IESG for Publication' to correct errors. Use the document's main page to request publication."
else:
f.help_text = u"You may not set the 'Submitted to IESG for Publication' using this form - Use the document's main page to request publication."
f.help_text = "You may not set the 'Submitted to IESG for Publication' using this form - Use the document's main page to request publication."
f = self.fields['tags']
f.queryset = f.queryset.filter(slug__in=get_tags_for_stream_id(doc.stream_id))
@ -1620,9 +1620,9 @@ def change_stream_state(request, name, state_type):
removed_tags = existing_tags - new_tags
l = []
if added_tags:
l.append(u"Tag%s %s set." % (pluralize(added_tags), ", ".join(t.name for t in added_tags)))
l.append("Tag%s %s set." % (pluralize(added_tags), ", ".join(t.name for t in added_tags)))
if removed_tags:
l.append(u"Tag%s %s cleared." % (pluralize(removed_tags), ", ".join(t.name for t in removed_tags)))
l.append("Tag%s %s cleared." % (pluralize(removed_tags), ", ".join(t.name for t in removed_tags)))
e.desc = " ".join(l)
e.save()
events.append(e)

View file

@ -51,7 +51,7 @@ class UploadMaterialForm(forms.Form):
self.fields["state"].widget = forms.HiddenInput()
self.fields["state"].queryset = self.fields["state"].queryset.filter(slug="active")
self.fields["state"].initial = self.fields["state"].queryset[0].pk
self.fields["name"].initial = u"%s-%s-" % (doc_type.slug, group.acronym)
self.fields["name"].initial = "%s-%s-" % (doc_type.slug, group.acronym)
else:
del self.fields["name"]
@ -157,17 +157,17 @@ def edit_material(request, name=None, acronym=None, action=None, doc_type=None):
if prev_title != doc.title:
e = DocEvent(doc=doc, rev=doc.rev, by=request.user.person, type='changed_document')
e.desc = u"Changed title to <b>%s</b>" % doc.title
e.desc = "Changed title to <b>%s</b>" % doc.title
if prev_title:
e.desc += u" from %s" % prev_title
e.desc += " from %s" % prev_title
e.save()
events.append(e)
if prev_abstract != doc.abstract:
e = DocEvent(doc=doc, rev=doc.rev, by=request.user.person, type='changed_document')
e.desc = u"Changed abstract to <b>%s</b>" % doc.abstract
e.desc = "Changed abstract to <b>%s</b>" % doc.abstract
if prev_abstract:
e.desc += u" from %s" % prev_abstract
e.desc += " from %s" % prev_abstract
e.save()
events.append(e)

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2016-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import os
import datetime
@ -771,7 +771,7 @@ def search_mail_archive(request, name, assignment_id):
except KeyError as e:
res["error"] = "No results found"
except Exception as e:
res["error"] = "Retrieval from mail archive failed: %s" % unicode(e)
res["error"] = "Retrieval from mail archive failed: %s" % str(e)
# raise # useful when debugging
return JsonResponse(res)

View file

@ -392,7 +392,7 @@ def clean_helper(form, formtype):
new_relations = {}
rfc_fields = {}
status_fields={}
for k in sorted(form.data.iterkeys()):
for k in sorted(form.data.keys()):
v = form.data[k]
if k.startswith('new_relation_row'):
if re.match('\d{1,4}',v):
@ -634,7 +634,7 @@ def generate_last_call_text(request, doc):
e.doc = doc
e.rev = doc.rev
e.desc = 'Last call announcement was generated'
e.text = unicode(new_text)
e.text = str(new_text)
e.save()
return e

View file

@ -38,7 +38,7 @@ class GroupAdmin(admin.ModelAdmin):
roles = Role.objects.filter(group=obj).order_by("name", "person__name").select_related('person')
res = []
for r in roles:
res.append(u'<a href="../../person/person/%s/">%s</a> (<a href="../../group/role/%s/">%s)' % (r.person.pk, escape(r.person.plain_name()), r.pk, r.name.name))
res.append('<a href="../../person/person/%s/">%s</a> (<a href="../../group/role/%s/">%s)' % (r.person.pk, escape(r.person.plain_name()), r.pk, r.name.name))
return ", ".join(res)
role_list.short_description = "Persons"
role_list.allow_tags = True
@ -144,7 +144,7 @@ class GroupHistoryAdmin(admin.ModelAdmin):
admin.site.register(GroupHistory, GroupHistoryAdmin)
class GroupURLAdmin(admin.ModelAdmin):
list_display = [u'id', 'group', 'name', 'url']
list_display = ['id', 'group', 'name', 'url']
raw_id_fields = ['group']
search_fields = ['name']
admin.site.register(GroupURL, GroupURLAdmin)
@ -157,7 +157,7 @@ admin.site.register(GroupMilestone, GroupMilestoneAdmin)
admin.site.register(GroupMilestoneHistory, GroupMilestoneAdmin)
class GroupStateTransitionsAdmin(admin.ModelAdmin):
list_display = [u'id', 'group', 'state']
list_display = ['id', 'group', 'state']
raw_id_fields = ['group', 'state']
admin.site.register(GroupStateTransitions, GroupStateTransitionsAdmin)
@ -183,7 +183,7 @@ class ChangeStateGroupEventAdmin(admin.ModelAdmin):
admin.site.register(ChangeStateGroupEvent, ChangeStateGroupEventAdmin)
class MilestoneGroupEventAdmin(admin.ModelAdmin):
list_display = [u'id', 'group', 'time', 'type', 'by', 'desc', 'milestone']
list_display = ['id', 'group', 'time', 'type', 'by', 'desc', 'milestone']
list_filter = ['time']
raw_id_fields = ['group', 'by', 'milestone']
admin.site.register(MilestoneGroupEvent, MilestoneGroupEventAdmin)

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2007-2019, All Rights Reserved
# Copyright The IETF Trust 2017-2019, All Rights Reserved
# -*- check-flake8 -*-
from __future__ import unicode_literals, print_function
from django.db.models import Q
from django.template.loader import render_to_string

View file

@ -18,7 +18,7 @@ class GroupChangesFeed(Feed):
return Group.objects.get(acronym=acronym)
def title(self, obj):
return u"Changes for %s %s" % (obj.acronym, obj.type)
return "Changes for %s %s" % (obj.acronym, obj.type)
def link(self, obj):
if not obj:
@ -47,8 +47,8 @@ class GroupChangesFeed(Feed):
return obj.time
def item_title(self, obj):
title = u"%s - %s" % (truncatewords(strip_tags(obj.desc), 10), obj.by)
title = "%s - %s" % (truncatewords(strip_tags(obj.desc), 10), obj.by)
if isinstance(obj, DocEvent):
title = u"Chartering: %s" % title
title = "Chartering: %s" % title
return title

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2007-2019, All Rights Reserved
# Copyright The IETF Trust 2017-2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
# Stdlib imports
import re

View file

@ -1,3 +1,4 @@
# Copyright The IETF Trust 2012-2019, All Rights Reserved
# generation of mails
import re
@ -13,7 +14,7 @@ from ietf.mailtrigger.utils import gather_address_lists
def email_admin_re_charter(request, group, subject, text, mailtrigger):
(to,cc) = gather_address_lists(mailtrigger,group=group)
full_subject = u"Regarding %s %s: %s" % (group.type.name, group.acronym, subject)
full_subject = "Regarding %s %s: %s" % (group.type.name, group.acronym, subject)
text = strip_tags(text)
send_mail(request, to, None, full_subject,
@ -28,32 +29,32 @@ def email_admin_re_charter(request, group, subject, text, mailtrigger):
def email_personnel_change(request, group, text, changed_personnel):
(to, cc) = gather_address_lists('group_personnel_change',group=group,changed_personnel=changed_personnel)
full_subject = u"Personnel change for %s %s" % (group.acronym,group.type.name)
full_subject = "Personnel change for %s %s" % (group.acronym,group.type.name)
send_mail_text(request, to, None, full_subject, text, cc=cc)
def email_milestones_changed(request, group, changes, states):
def wrap_up_email(addrs, text):
subject = u"Milestones changed for %s %s" % (group.acronym, group.type.name)
subject = "Milestones changed for %s %s" % (group.acronym, group.type.name)
if re.search("Added .* for review, due",text):
subject = u"Review Required - " + subject
subject = "Review Required - " + subject
text = wordwrap(strip_tags(text), 78)
text += "\n\n"
text += u"URL: %s" % (settings.IDTRACKER_BASE_URL + group.about_url())
text += "URL: %s" % (settings.IDTRACKER_BASE_URL + group.about_url())
send_mail_text(request, addrs.to, None, subject, text, cc=addrs.cc)
# first send to those who should see any edits (such as management and chairs)
addrs = gather_address_lists('group_milestones_edited',group=group)
if addrs.to or addrs.cc:
wrap_up_email(addrs, u"\n\n".join(c + "." for c in changes))
wrap_up_email(addrs, "\n\n".join(c + "." for c in changes))
# then send only the approved milestones to those who shouldn't be
# bothered with milestones pending approval
addrs = gather_address_lists('group_approved_milestones_edited',group=group)
msg = u"\n\n".join(c + "." for c,s in zip(changes,states) if not s == "review")
msg = "\n\n".join(c + "." for c,s in zip(changes,states) if not s == "review")
if (addrs.to or addrs.cc) and msg:
wrap_up_email(addrs, msg)

View file

@ -1,6 +1,6 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
import collections

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.10 on 2018-02-20 10:52
from __future__ import unicode_literals
import datetime
from django.db import migrations, models

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-10 15:58
from __future__ import unicode_literals
import django.core.validators
import django.db.models.deletion

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2018-2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-10 15:58
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations
@ -10,7 +11,7 @@ import debug # pyflakes:ignore
from ietf.review.utils import active_review_teams
group_type_features = {
u'ag': {
'ag': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -25,7 +26,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'area': {
'area': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -40,7 +41,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'dir': {
'dir': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair,secr',
'agenda_type': None,
@ -55,7 +56,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'review': {
'review': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair,secr',
'agenda_type': None,
@ -70,7 +71,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': True,
'material_types': 'slides'},
u'iab': {
'iab': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -85,7 +86,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'ietf': {
'ietf': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -100,7 +101,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'individ': {
'individ': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': None,
@ -115,7 +116,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'irtf': {
'irtf': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -130,7 +131,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'isoc': {
'isoc': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': None,
@ -145,7 +146,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'nomcom': {
'nomcom': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'side',
@ -160,7 +161,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'program': {
'program': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'lead',
'agenda_type': None,
@ -175,7 +176,7 @@ group_type_features = {
'has_milestones': True,
'has_reviews': False,
'material_types': 'slides'},
u'rfcedtyp': {
'rfcedtyp': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'side',
@ -190,7 +191,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'rg': {
'rg': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -205,7 +206,7 @@ group_type_features = {
'has_milestones': True,
'has_reviews': False,
'material_types': 'slides'},
u'sdo': {
'sdo': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': None,
@ -220,7 +221,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'team': {
'team': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',
@ -235,7 +236,7 @@ group_type_features = {
'has_milestones': False,
'has_reviews': False,
'material_types': 'slides'},
u'wg': {
'wg': {
'about_page': 'ietf.group.views.group_about',
'admin_roles': 'chair',
'agenda_type': 'ietf',

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-10 07:51
from __future__ import unicode_literals
import django.core.validators
from django.db import migrations, models

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-09 09:02
from __future__ import unicode_literals
import json
import re

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-16 05:53
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-09 09:02
from __future__ import unicode_literals
from django.db import migrations
@ -9,7 +9,7 @@ from django.db import migrations
import debug # pyflakes:ignore
group_type_features = {
u'ag': {
'ag': {
'custom_group_roles': True,
'has_session_materials': True,
'acts_like_wg': True,
@ -22,7 +22,7 @@ group_type_features = {
'matman_roles': ['ad', 'chair', 'delegate', 'secr'],
'role_order': ['chair', 'secr'],
},
u'area': {
'area': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -35,7 +35,7 @@ group_type_features = {
'matman_roles': ['ad', 'chair', 'delegate', 'secr'],
'role_order': ['chair', 'secr'],
},
u'dir': {
'dir': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -48,7 +48,7 @@ group_type_features = {
'matman_roles': ['ad', 'chair', 'delegate', 'secr'],
'role_order': ['chair', 'secr'],
},
u'review': {
'review': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -61,7 +61,7 @@ group_type_features = {
'matman_roles': ['ad', 'secr'],
'role_order': ['chair', 'secr'],
},
u'iab': {
'iab': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -74,7 +74,7 @@ group_type_features = {
'matman_roles': ['chair', 'delegate'],
'role_order': ['chair', 'secr'],
},
u'ietf': {
'ietf': {
'custom_group_roles': True,
'has_session_materials': True,
'acts_like_wg': False,
@ -87,7 +87,7 @@ group_type_features = {
'matman_roles': ['chair', 'delegate'],
'role_order': ['chair', 'secr'],
},
u'individ': {
'individ': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -100,7 +100,7 @@ group_type_features = {
'matman_roles': [],
'role_order': ['chair', 'secr'],
},
u'irtf': {
'irtf': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -113,7 +113,7 @@ group_type_features = {
'matman_roles': ['chair', 'delegate', 'secr'],
'role_order': ['chair', 'secr'],
},
u'isoc': {
'isoc': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -126,7 +126,7 @@ group_type_features = {
'matman_roles': ['chair', 'secr'],
'role_order': ['chair', 'secr'],
},
u'nomcom': {
'nomcom': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -139,7 +139,7 @@ group_type_features = {
'matman_roles': ['chair'],
'role_order': ['chair', 'member', 'advisor'],
},
u'program': {
'program': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -152,7 +152,7 @@ group_type_features = {
'matman_roles': ['chair', 'secr'],
'role_order': ['chair', 'secr'],
},
u'rfcedtyp': {
'rfcedtyp': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -165,7 +165,7 @@ group_type_features = {
'matman_roles': [],
'role_order': ['chair', 'secr'],
},
u'rg': {
'rg': {
'custom_group_roles': False,
'has_session_materials': True,
'acts_like_wg': True,
@ -178,7 +178,7 @@ group_type_features = {
'matman_roles': ['chair', 'secr'],
'role_order': ['chair', 'secr'],
},
u'sdo': {
'sdo': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -191,7 +191,7 @@ group_type_features = {
'matman_roles': [],
'role_order': ['liaiman'],
},
u'team': {
'team': {
'custom_group_roles': True,
'has_session_materials': False,
'acts_like_wg': False,
@ -204,7 +204,7 @@ group_type_features = {
'matman_roles': [],
'role_order': ['chair', 'member', 'matman'],
},
u'wg': {
'wg': {
'custom_group_roles': False,
'has_session_materials': True,
'acts_like_wg': True,
@ -224,7 +224,7 @@ def forward(apps, schema_editor):
for type in group_type_features:
features = group_type_features[type]
gf = GroupFeatures.objects.get(type=type)
for k,v in features.items():
for k,v in list(features.items()):
setattr(gf, k, v)
gf.save()
# This migration does not remove or change any previous fields, and executes

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-19 10:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-01-22 10:12
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion

View file

@ -1,7 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2019-01-09 09:02
from __future__ import unicode_literals
from django.db import migrations
@ -128,13 +128,13 @@ def forward(apps, schema_editor):
for slug in group_type_features:
typename = group_type_features[slug]['grouptypename']
gt, _ = GroupTypeName.objects.get_or_create(slug=slug)
for k,v in typename.items():
for k,v in list(typename.items()):
setattr(gt, k, v)
gt.save()
#
features = group_type_features[slug]['groupfeatures']
gf, _ = GroupFeatures.objects.get_or_create(type_id=slug)
for k,v in features.items():
for k,v in list(features.items()):
setattr(gf, k, v)
gf.save()

View file

@ -1,6 +1,7 @@
# Copyright The IETF Trust 2019, All Rights Reserved
# -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-02-25 13:02
from __future__ import unicode_literals
from django.db import migrations

Some files were not shown because too many files have changed in this diff Show more