Removed some Py2 compatibility decorators.

- Legacy-Id: 17673
This commit is contained in:
Henrik Levkowetz 2020-04-21 13:54:31 +00:00
parent 493f393217
commit 9aeda11a29
23 changed files with 14 additions and 119 deletions

3
.gitignore vendored
View file

@ -44,10 +44,11 @@
/share
/static
/testresult
/tmp
/tmp-nomcom-public-keys-dir
/trunk27
/trunk36
/trunk37
/unix.tag
/tmp-nomcom-public-keys-dir
*.pyc
__pycache__

18
env/.gitignore vendored
View file

@ -1,10 +1,12 @@
/bin
/share
/selenium
/etc
/local
/lib
/include
/pip-selfcheck.json
/.Python
/bin
/etc
/include
/lib
/lib64
/local
/man
/pip-selfcheck.json
/pyvenv.cfg
/selenium
/share

View file

@ -6,14 +6,12 @@ from django.contrib.auth.models import User
from django.db import models
from django.db.models import signals
from django.urls import reverse as urlreverse
from django.utils.encoding import python_2_unicode_compatible
from ietf.doc.models import Document, DocEvent, State
from ietf.group.models import Group
from ietf.person.models import Person, Email
from ietf.utils.models import ForeignKey
@python_2_unicode_compatible
class CommunityList(models.Model):
user = ForeignKey(User, blank=True, null=True)
group = ForeignKey(Group, blank=True, null=True)
@ -39,7 +37,6 @@ class CommunityList(models.Model):
return ""
@python_2_unicode_compatible
class SearchRule(models.Model):
# these types define the UI for setting up the rule, and also
# helps when interpreting the rule and matching documents
@ -85,7 +82,6 @@ class SearchRule(models.Model):
def __str__(self):
return "%s %s %s/%s/%s/%s" % (self.community_list, self.rule_type, self.state, self.group, self.person, self.text)
@python_2_unicode_compatible
class EmailSubscription(models.Model):
community_list = ForeignKey(CommunityList)
email = ForeignKey(Email)

View file

@ -5,7 +5,6 @@
from django.db import models
from django.core.exceptions import ValidationError
from django.template import Context
from django.utils.encoding import python_2_unicode_compatible
from ietf.group.models import Group
from ietf.name.models import DBTemplateTypeName
@ -19,7 +18,6 @@ TEMPLATE_TYPES = (
)
@python_2_unicode_compatible
class DBTemplate(models.Model):
path = models.CharField( max_length=255, unique=True, blank=False, null=False, )
title = models.CharField( max_length=255, blank=False, null=False, )

View file

@ -16,7 +16,7 @@ from django.core.validators import URLValidator, RegexValidator
from django.urls import reverse as urlreverse
from django.contrib.contenttypes.models import ContentType
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible, force_text
from django.utils.encoding import force_text
from django.utils.html import mark_safe # type:ignore
import debug # pyflakes:ignore
@ -36,7 +36,6 @@ from ietf.utils.models import ForeignKey
logger = logging.getLogger('django')
@python_2_unicode_compatible
class StateType(models.Model):
slug = models.CharField(primary_key=True, max_length=30) # draft, draft-iesg, charter, ...
label = models.CharField(max_length=255, help_text="Label that should be used (e.g. in admin) for state drop-down for this type of state") # State, IESG state, WG state, ...
@ -58,7 +57,6 @@ def check_statetype_slugs(app_configs, **kwargs):
))
return errors
@python_2_unicode_compatible
class State(models.Model):
type = ForeignKey(StateType)
slug = models.SlugField()
@ -543,7 +541,6 @@ class DocumentInfo(models.Model):
STATUSCHANGE_RELATIONS = ('tops','tois','tohist','toinf','tobcp','toexp')
@python_2_unicode_compatible
class RelatedDocument(models.Model):
source = ForeignKey('Document')
target = ForeignKey('DocAlias')
@ -617,7 +614,6 @@ class DocumentAuthorInfo(models.Model):
abstract = True
ordering = ["document", "order"]
@python_2_unicode_compatible
class DocumentAuthor(DocumentAuthorInfo):
document = ForeignKey('Document')
@ -631,7 +627,6 @@ validate_docname = RegexValidator(
'invalid'
)
@python_2_unicode_compatible
class Document(DocumentInfo):
name = models.CharField(max_length=255, validators=[validate_docname,], unique=True) # immutable
@ -866,7 +861,6 @@ class DocumentURL(models.Model):
desc = models.CharField(max_length=255, default='', blank=True)
url = models.URLField(max_length=2083) # 2083 is the legal max for URLs
@python_2_unicode_compatible
class RelatedDocHistory(models.Model):
source = ForeignKey('DocHistory')
target = ForeignKey('DocAlias', related_name="reversely_related_document_history_set")
@ -874,7 +868,6 @@ class RelatedDocHistory(models.Model):
def __str__(self):
return u"%s %s %s" % (self.source.doc.name, self.relationship.name.lower(), self.target.name)
@python_2_unicode_compatible
class DocHistoryAuthor(DocumentAuthorInfo):
# use same naming convention as non-history version to make it a bit
# easier to write generic code
@ -883,7 +876,6 @@ class DocHistoryAuthor(DocumentAuthorInfo):
def __str__(self):
return u"%s %s (%s)" % (self.document.doc.name, self.person, self.order)
@python_2_unicode_compatible
class DocHistory(DocumentInfo):
doc = ForeignKey(Document, related_name="history_set")
# the name here is used to capture the canonical name at the time
@ -934,7 +926,6 @@ class DocHistory(DocumentInfo):
verbose_name = "document history"
verbose_name_plural = "document histories"
@python_2_unicode_compatible
class DocAlias(models.Model):
"""This is used for documents that may appear under multiple names,
and in particular for RFCs, which for continuity still keep the
@ -1042,7 +1033,6 @@ EVENT_TYPES = [
("removed_related_ipr", "Removed related IPR"),
]
@python_2_unicode_compatible
class DocEvent(models.Model):
"""An occurrence for a document, used for tracking who, when and what."""
time = models.DateTimeField(default=datetime.datetime.now, help_text="When the event happened", db_index=True)
@ -1086,7 +1076,6 @@ class ConsensusDocEvent(DocEvent):
consensus = models.NullBooleanField(default=None)
# IESG events
@python_2_unicode_compatible
class BallotType(models.Model):
doc_type = ForeignKey(DocTypeName, blank=True, null=True)
slug = models.SlugField()
@ -1221,7 +1210,6 @@ class SubmissionDocEvent(DocEvent):
submission = ForeignKey(ietf.submit.models.Submission)
# dumping store for removed events
@python_2_unicode_compatible
class DeletedEvent(models.Model):
content_type = ForeignKey(ContentType)
json = models.TextField(help_text="Deleted object in JSON format, with attribute names chosen to be suitable for passing into the relevant create method.")

View file

@ -15,7 +15,6 @@ from django.core.validators import RegexValidator
from django.db import models
from django.db.models.deletion import CASCADE
from django.dispatch import receiver
from django.utils.encoding import python_2_unicode_compatible
from simple_history.models import HistoricalRecords
@ -29,7 +28,6 @@ from ietf.utils import log
from ietf.utils.models import ForeignKey, OneToOneField
@python_2_unicode_compatible
class GroupInfo(models.Model):
time = models.DateTimeField(default=datetime.datetime.now)
name = models.CharField(max_length=80)
@ -252,7 +250,6 @@ class GroupHistory(GroupInfo):
class Meta:
verbose_name_plural="group histories"
@python_2_unicode_compatible
class GroupURL(models.Model):
group = ForeignKey(Group)
name = models.CharField(max_length=255)
@ -261,7 +258,6 @@ class GroupURL(models.Model):
def __str__(self):
return u"%s (%s)" % (self.url, self.name)
@python_2_unicode_compatible
class GroupMilestoneInfo(models.Model):
group = ForeignKey(Group)
# a group has two sets of milestones, current milestones
@ -289,7 +285,6 @@ class GroupMilestoneHistory(GroupMilestoneInfo):
time = models.DateTimeField()
milestone = ForeignKey(GroupMilestone, related_name="history_set")
@python_2_unicode_compatible
class GroupStateTransitions(models.Model):
"""Captures that a group has overriden the default available
document state transitions for a certain state."""
@ -310,7 +305,6 @@ GROUP_EVENT_CHOICES = [
("status_update", "Status update"),
]
@python_2_unicode_compatible
class GroupEvent(models.Model):
"""An occurrence for a group, used for tracking who, when and what."""
group = ForeignKey(Group)
@ -331,7 +325,6 @@ class ChangeStateGroupEvent(GroupEvent):
class MilestoneGroupEvent(GroupEvent):
milestone = ForeignKey(GroupMilestone)
@python_2_unicode_compatible
class Role(models.Model):
name = ForeignKey(RoleName)
group = ForeignKey(Group)
@ -349,7 +342,6 @@ class Role(models.Model):
class Meta:
ordering = ['name_id', ]
@python_2_unicode_compatible
class RoleHistory(models.Model):
# RoleHistory doesn't have a time field as it's not supposed to be
# used on its own - there should always be a GroupHistory

View file

@ -37,9 +37,7 @@
import datetime
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class TelechatAgendaItem(models.Model):
TYPE_CHOICES = (
(1, "Any Other Business (WG News, New Proposals, etc.)"),
@ -80,7 +78,6 @@ class TelechatDateManager(models.Manager):
def active(self):
return self.get_queryset().filter(date__gte=datetime.date.today())
@python_2_unicode_compatible
class TelechatDate(models.Model):
objects = TelechatDateManager()

View file

@ -7,7 +7,6 @@ import datetime
from django.conf import settings
from django.db import models
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from ietf.doc.models import DocAlias, DocEvent
from ietf.name.models import DocRelationshipName,IprDisclosureStateName,IprLicenseTypeName,IprEventTypeName
@ -15,7 +14,6 @@ from ietf.person.models import Person
from ietf.message.models import Message
from ietf.utils.models import ForeignKey
@python_2_unicode_compatible
class IprDisclosureBase(models.Model):
by = ForeignKey(Person) # who was logged in, or System if nobody was logged in
compliant = models.BooleanField("Complies to RFC3979", default=True)
@ -158,7 +156,6 @@ class GenericIprDisclosure(IprDisclosureBase):
holder_contact_info = models.TextField(blank=True, help_text="Address, phone, etc.")
statement = models.TextField() # includes licensing info
@python_2_unicode_compatible
class IprDocRel(models.Model):
disclosure = ForeignKey(IprDisclosureBase)
document = ForeignKey(DocAlias)
@ -189,7 +186,6 @@ class IprDocRel(models.Model):
else:
return "%s which applies to %s" % (self.disclosure, self.document.name)
@python_2_unicode_compatible
class RelatedIpr(models.Model):
source = ForeignKey(IprDisclosureBase,related_name='relatedipr_source_set')
target = ForeignKey(IprDisclosureBase,related_name='relatedipr_target_set')
@ -198,7 +194,6 @@ class RelatedIpr(models.Model):
def __str__(self):
return "%s %s %s" % (self.source.title, self.relationship.name.lower(), self.target.title)
@python_2_unicode_compatible
class IprEvent(models.Model):
time = models.DateTimeField(auto_now_add=True)
type = ForeignKey(IprEventTypeName)

View file

@ -5,7 +5,6 @@
from django.conf import settings
from django.urls import reverse as urlreverse
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.text import slugify
from ietf.person.models import Email, Person
@ -27,7 +26,6 @@ STATE_EVENT_MAPPING = {
}
@python_2_unicode_compatible
class LiaisonStatement(models.Model):
title = models.CharField(max_length=255)
from_groups = models.ManyToManyField(Group, blank=True, related_name='liaisonstatement_from_set')
@ -201,7 +199,6 @@ class LiaisonStatement(models.Model):
approval_set.intersection_update(group.liaison_approvers())
return list(set([ r.email.address for r in approval_set ]))
@python_2_unicode_compatible
class LiaisonStatementAttachment(models.Model):
statement = ForeignKey(LiaisonStatement)
document = ForeignKey(Document)
@ -211,7 +208,6 @@ class LiaisonStatementAttachment(models.Model):
return self.document.name
@python_2_unicode_compatible
class RelatedLiaisonStatement(models.Model):
source = ForeignKey(LiaisonStatement, related_name='source_of_set')
target = ForeignKey(LiaisonStatement, related_name='target_of_set')
@ -221,7 +217,6 @@ class RelatedLiaisonStatement(models.Model):
return "%s %s %s" % (self.source.title, self.relationship.name.lower(), self.target.title)
@python_2_unicode_compatible
class LiaisonStatementGroupContacts(models.Model):
group = ForeignKey(Group, unique=True, null=True)
contacts = models.CharField(max_length=255,blank=True)
@ -231,7 +226,6 @@ class LiaisonStatementGroupContacts(models.Model):
return "%s" % self.group.name
@python_2_unicode_compatible
class LiaisonStatementEvent(models.Model):
time = models.DateTimeField(auto_now_add=True)
type = ForeignKey(LiaisonStatementEventTypeName)

View file

@ -5,12 +5,10 @@
from django.conf import settings
from django.core.validators import validate_email
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from ietf.person.models import Person
from ietf.utils.models import ForeignKey
@python_2_unicode_compatible
class List(models.Model):
name = models.CharField(max_length=32)
description = models.CharField(max_length=256)
@ -21,7 +19,6 @@ class List(models.Model):
def info_url(self):
return settings.MAILING_LIST_INFO_URL % {'list_addr': self.name }
@python_2_unicode_compatible
class Subscribed(models.Model):
time = models.DateTimeField(auto_now_add=True)
email = models.CharField(max_length=128, validators=[validate_email])
@ -31,7 +28,6 @@ class Subscribed(models.Model):
class Meta:
verbose_name_plural = "Subscribed"
@python_2_unicode_compatible
class Whitelisted(models.Model):
time = models.DateTimeField(auto_now_add=True)
email = models.CharField("Email address", max_length=64, validators=[validate_email])

View file

@ -4,7 +4,6 @@
from django.db import models
from django.template import Template, Context
from django.utils.encoding import python_2_unicode_compatible
from email.utils import parseaddr
from ietf.utils.mail import formataddr, get_email_addresses_from_text
@ -31,7 +30,6 @@ def clean_duplicates(addrlist):
addresses.append(addr)
return addresses
@python_2_unicode_compatible
class MailTrigger(models.Model):
slug = models.CharField(max_length=64, primary_key=True)
desc = models.TextField(blank=True)
@ -44,7 +42,6 @@ class MailTrigger(models.Model):
def __str__(self):
return self.slug
@python_2_unicode_compatible
class Recipient(models.Model):
slug = models.CharField(max_length=32, primary_key=True)
desc = models.TextField(blank=True)

View file

@ -22,7 +22,6 @@ from django.conf import settings
# mostly used by json_dict()
#from django.template.defaultfilters import slugify, date as date_format, time as time_format
from django.template.defaultfilters import date as date_format
from django.utils.encoding import python_2_unicode_compatible
from django.utils.text import slugify
from ietf.dbtemplate.models import DBTemplate
@ -58,7 +57,6 @@ def fmt_date(o):
d = datetime_safe.new_date(o)
return d.strftime(DATE_FORMAT)
@python_2_unicode_compatible
class Meeting(models.Model):
# number is either the number for IETF meetings, or some other
# identifier for interim meetings/IESG retreats/liaison summits/...
@ -308,7 +306,6 @@ class Meeting(models.Model):
# === Rooms, Resources, Floorplans =============================================
@python_2_unicode_compatible
class ResourceAssociation(models.Model):
name = ForeignKey(RoomResourceName)
icon = models.CharField(max_length=64) # icon to be found in /static/img
@ -325,7 +322,6 @@ class ResourceAssociation(models.Model):
res1['resource_id'] = self.pk
return res1
@python_2_unicode_compatible
class Room(models.Model):
meeting = ForeignKey(Meeting)
modified = models.DateTimeField(auto_now=True)
@ -418,7 +414,6 @@ def floorplan_path(instance, filename):
root, ext = os.path.splitext(filename)
return "%s/floorplan-%s-%s%s" % (settings.FLOORPLAN_MEDIA_DIR, instance.meeting.number, xslugify(instance.name), ext)
@python_2_unicode_compatible
class FloorPlan(models.Model):
name = models.CharField(max_length=255)
short = models.CharField(max_length=3, default='')
@ -435,7 +430,6 @@ class FloorPlan(models.Model):
# === Schedules, Sessions, Timeslots and Assignments ===========================
@python_2_unicode_compatible
class TimeSlot(models.Model):
"""
Everything that would appear on the meeting agenda of a meeting is
@ -603,7 +597,6 @@ class TimeSlot(models.Model):
# end of TimeSlot
@python_2_unicode_compatible
class Schedule(models.Model):
"""
Each person may have multiple schedules saved.
@ -707,7 +700,6 @@ class Schedule(models.Model):
self.delete()
# to be renamed SchedTimeSessAssignments (stsa)
@python_2_unicode_compatible
class SchedTimeSessAssignment(models.Model):
"""
This model provides an N:M relationship between Session and TimeSlot.
@ -812,7 +804,6 @@ class SchedTimeSessAssignment(models.Model):
return "-".join(components).lower()
@python_2_unicode_compatible
class Constraint(models.Model):
"""
Specifies a constraint on the scheduling.
@ -883,7 +874,6 @@ class Constraint(models.Model):
return ct1
@python_2_unicode_compatible
class SessionPresentation(models.Model):
session = ForeignKey('Session')
document = ForeignKey(Document)
@ -901,7 +891,6 @@ class SessionPresentation(models.Model):
constraint_cache_uses = 0
constraint_cache_initials = 0
@python_2_unicode_compatible
class Session(models.Model):
"""Session records that a group should have a session on the
meeting (time and location is stored in a TimeSlot) - if multiple
@ -1215,7 +1204,6 @@ class Session(models.Model):
else:
return self.group.acronym
@python_2_unicode_compatible
class SchedulingEvent(models.Model):
session = ForeignKey(Session)
time = models.DateTimeField(default=datetime.datetime.now, help_text="When the event happened")
@ -1225,7 +1213,6 @@ class SchedulingEvent(models.Model):
def __str__(self):
return u'%s : %s : %s : %s' % (self.session, self.status, self.time, self.by)
@python_2_unicode_compatible
class ImportantDate(models.Model):
meeting = ForeignKey(Meeting)
date = models.DateField()

View file

@ -6,7 +6,6 @@ import datetime
import email.utils
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
import debug # pyflakes:ignore
@ -17,7 +16,6 @@ from ietf.name.models import RoleName
from ietf.utils.models import ForeignKey
from ietf.utils.mail import get_email_addresses_from_text
@python_2_unicode_compatible
class Message(models.Model):
time = models.DateTimeField(default=datetime.datetime.now)
by = ForeignKey(Person)
@ -48,7 +46,6 @@ class Message(models.Model):
return r if isinstance(r, list) else get_email_addresses_from_text(r)
@python_2_unicode_compatible
class MessageAttachment(models.Model):
message = ForeignKey(Message)
filename = models.CharField(max_length=255, db_index=True, blank=True)
@ -61,7 +58,6 @@ class MessageAttachment(models.Model):
return self.filename
@python_2_unicode_compatible
class SendQueue(models.Model):
time = models.DateTimeField(default=datetime.datetime.now)
by = ForeignKey(Person)
@ -80,7 +76,6 @@ class SendQueue(models.Model):
return "'%s' %s -> %s (sent at %s)" % (self.message.subject, self.message.frm, self.message.to, self.sent_at or "<not yet>")
@python_2_unicode_compatible
class AnnouncementFrom(models.Model):
name = ForeignKey(RoleName)
group = ForeignKey(Group)

View file

@ -3,11 +3,9 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from ietf.utils.models import ForeignKey
@python_2_unicode_compatible
class NameModel(models.Model):
slug = models.CharField(max_length=32, primary_key=True)
name = models.CharField(max_length=255)

View file

@ -10,7 +10,6 @@ from django.conf import settings
from django.contrib.auth.models import User
from django.template.loader import render_to_string
from django.template.defaultfilters import linebreaks # type: ignore
from django.utils.encoding import python_2_unicode_compatible
import debug # pyflakes:ignore
@ -43,7 +42,6 @@ class ReminderDates(models.Model):
nomcom = ForeignKey('NomCom')
@python_2_unicode_compatible
class NomCom(models.Model):
public_key = models.FileField(storage=NoLocationMigrationFileSystemStorage(location=settings.NOMCOM_PUBLIC_KEYS_DIR),
upload_to=upload_path_handler, blank=True, null=True)
@ -110,7 +108,6 @@ def delete_nomcom(sender, **kwargs):
post_delete.connect(delete_nomcom, sender=NomCom)
@python_2_unicode_compatible
class Nomination(models.Model):
position = ForeignKey('Position')
candidate_name = models.CharField(verbose_name='Candidate name', max_length=255)
@ -135,7 +132,6 @@ class Nomination(models.Model):
return "%s (%s)" % (self.candidate_name, self.candidate_email)
@python_2_unicode_compatible
class Nominee(models.Model):
email = ForeignKey(Email)
@ -163,7 +159,6 @@ class Nominee(models.Model):
else:
return self.email.address
@python_2_unicode_compatible
class NomineePosition(models.Model):
position = ForeignKey('Position')
@ -193,7 +188,6 @@ class NomineePosition(models.Model):
nominees__in=[self.nominee])
@python_2_unicode_compatible
class Position(models.Model):
nomcom = ForeignKey('NomCom')
name = models.CharField(verbose_name='Name', max_length=255, help_text='This short description will appear on the Nomination and Feedback pages. Be as descriptive as necessary. Past examples: "Transport AD", "IAB Member"')
@ -254,7 +248,6 @@ class Position(models.Model):
else:
return specific_reqs
@python_2_unicode_compatible
class Topic(models.Model):
nomcom = ForeignKey('NomCom')
subject = models.CharField(verbose_name='Name', max_length=255, help_text='This short description will appear on the Feedback pages.')
@ -284,7 +277,6 @@ class Topic(models.Model):
rendered = linebreaks(rendered)
return rendered
@python_2_unicode_compatible
class Feedback(models.Model):
nomcom = ForeignKey('NomCom')
author = models.EmailField(verbose_name='Author', blank=True)

View file

@ -17,7 +17,7 @@ from django.core.validators import validate_email
from django.db import models
from django.template.loader import render_to_string
from django.urls import reverse as urlreverse
from django.utils.encoding import python_2_unicode_compatible, smart_bytes
from django.utils.encoding import smart_bytes
from django.utils.text import slugify
from simple_history.models import HistoricalRecords
@ -33,7 +33,6 @@ from ietf.utils import log
from ietf.utils.models import ForeignKey, OneToOneField
@python_2_unicode_compatible
class Person(models.Model):
history = HistoricalRecords()
user = OneToOneField(User, blank=True, null=True, on_delete=models.SET_NULL)
@ -239,7 +238,6 @@ class Person(models.Model):
return [ (v, n) for (v, n, r) in PERSON_API_KEY_VALUES if r==None or has_role(self.user, r) ]
@python_2_unicode_compatible
class Alias(models.Model):
"""This is used for alternative forms of a name. This is the
primary lookup point for names, and should always contain the
@ -267,7 +265,6 @@ class Alias(models.Model):
class Meta:
verbose_name_plural = "Aliases"
@python_2_unicode_compatible
class Email(models.Model):
history = HistoricalRecords()
address = models.CharField(max_length=64, primary_key=True, validators=[validate_email])
@ -341,7 +338,6 @@ PERSON_API_KEY_VALUES = [
]
PERSON_API_KEY_ENDPOINTS = [ (v, n) for (v, n, r) in PERSON_API_KEY_VALUES ]
@python_2_unicode_compatible
class PersonalApiKey(models.Model):
person = ForeignKey(Person, related_name='apikeys')
endpoint = models.CharField(max_length=128, null=False, blank=False, choices=PERSON_API_KEY_ENDPOINTS)
@ -388,7 +384,6 @@ PERSON_EVENT_CHOICES = [
("email_address_deactivated", "Email address deactivated"),
]
@python_2_unicode_compatible
class PersonEvent(models.Model):
person = ForeignKey(Person)
time = models.DateTimeField(default=datetime.datetime.now, help_text="When the event happened")

View file

@ -3,11 +3,9 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from ietf.utils.models import ForeignKey
@python_2_unicode_compatible
class Redirect(models.Model):
"""Mapping of CGI script to url. The "rest" is a
sprintf-style string with %(param)s entries to insert
@ -28,7 +26,6 @@ class Redirect(models.Model):
def __str__(self):
return "%s -> %s/%s" % (self.cgi, self.url, self.rest)
@python_2_unicode_compatible
class Suffix(models.Model):
"""This is a "rest" and "remove" (see Redirect class)
for requests with command=.
@ -40,7 +37,6 @@ class Suffix(models.Model):
class Meta:
verbose_name_plural="Suffixes"
@python_2_unicode_compatible
class Command(models.Model):
"""When a request comes in with a command= argument,
the command is looked up in this table to see if there

View file

@ -7,7 +7,6 @@ import datetime
from simple_history.models import HistoricalRecords
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from ietf.doc.models import Document
from ietf.group.models import Group
@ -17,7 +16,6 @@ from ietf.name.models import ReviewTypeName, ReviewRequestStateName, ReviewResul
from ietf.utils.validators import validate_regular_expression_string
from ietf.utils.models import ForeignKey, OneToOneField
@python_2_unicode_compatible
class ReviewerSettings(models.Model):
"""Keeps track of admin data associated with a reviewer in a team."""
history = HistoricalRecords(history_change_reason_field=models.TextField(null=True))
@ -46,7 +44,6 @@ class ReviewerSettings(models.Model):
class Meta:
verbose_name_plural = "reviewer settings"
@python_2_unicode_compatible
class ReviewSecretarySettings(models.Model):
"""Keeps track of admin data associated with a secretary in a team."""
team = ForeignKey(Group, limit_choices_to=~models.Q(reviewteamsettings=None))
@ -61,7 +58,6 @@ class ReviewSecretarySettings(models.Model):
class Meta:
verbose_name_plural = "review secretary settings"
@python_2_unicode_compatible
class UnavailablePeriod(models.Model):
history = HistoricalRecords(history_change_reason_field=models.TextField(null=True))
team = ForeignKey(Group, limit_choices_to=~models.Q(reviewteamsettings=None))
@ -93,7 +89,6 @@ class UnavailablePeriod(models.Model):
def __str__(self):
return "{} is unavailable in {} {} - {}".format(self.person, self.team.acronym, self.start_date or "", self.end_date or "")
@python_2_unicode_compatible
class ReviewWish(models.Model):
"""Reviewer wishes to review a document when it becomes available for review."""
time = models.DateTimeField(default=datetime.datetime.now)
@ -108,7 +103,6 @@ class ReviewWish(models.Model):
verbose_name_plural = "review wishes"
@python_2_unicode_compatible
class NextReviewerInTeam(models.Model):
team = ForeignKey(Group, limit_choices_to=~models.Q(reviewteamsettings=None))
next_reviewer = ForeignKey(Person)
@ -120,7 +114,6 @@ class NextReviewerInTeam(models.Model):
verbose_name = "next reviewer in team setting"
verbose_name_plural = "next reviewer in team settings"
@python_2_unicode_compatible
class ReviewRequest(models.Model):
"""Represents a request for a review and the process it goes through."""
history = HistoricalRecords(history_change_reason_field=models.TextField(null=True))
@ -146,7 +139,6 @@ class ReviewRequest(models.Model):
def request_closed_time(self):
return self.doc.request_closed_time(self) or self.time
@python_2_unicode_compatible
class ReviewAssignment(models.Model):
""" One of possibly many reviews assigned in response to a ReviewRequest """
history = HistoricalRecords(history_change_reason_field=models.TextField(null=True))
@ -183,7 +175,6 @@ def get_default_review_types():
def get_default_review_results():
return ReviewResultName.objects.filter(slug__in=['not-ready', 'right-track', 'almost-ready', 'ready-issues', 'ready-nits', 'ready'])
@python_2_unicode_compatible
class ReviewTeamSettings(models.Model):
"""Holds configuration specific to groups that are review teams"""
group = OneToOneField(Group)

View file

@ -6,7 +6,6 @@ import os
from django.conf import settings
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from ietf.meeting.models import Meeting
@ -61,7 +60,6 @@ class InterimMeeting(Meeting):
else:
return ''
@python_2_unicode_compatible
class Registration(models.Model):
rsn = models.AutoField(primary_key=True)
fname = models.CharField(max_length=255)

View file

@ -3,7 +3,6 @@
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
import debug # pyflakes:ignore
@ -13,7 +12,6 @@ from ietf.person.models import Person
from ietf.utils.models import ForeignKey
@python_2_unicode_compatible
class AffiliationAlias(models.Model):
"""Records that alias should be treated as name for statistical
purposes."""
@ -31,7 +29,6 @@ class AffiliationAlias(models.Model):
class Meta:
verbose_name_plural = "affiliation aliases"
@python_2_unicode_compatible
class AffiliationIgnoredEnding(models.Model):
"""Records that ending should be stripped from the affiliation for statistical purposes."""
@ -40,7 +37,6 @@ class AffiliationIgnoredEnding(models.Model):
def __str__(self):
return self.ending
@python_2_unicode_compatible
class CountryAlias(models.Model):
"""Records that alias should be treated as country for statistical
purposes."""
@ -54,7 +50,6 @@ class CountryAlias(models.Model):
class Meta:
verbose_name_plural = "country aliases"
@python_2_unicode_compatible
class MeetingRegistration(models.Model):
"""Registration attendee records from the IETF registration system"""
meeting = ForeignKey(Meeting)

View file

@ -7,7 +7,6 @@ import email
import jsonfield
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
import debug # pyflakes:ignore
@ -28,7 +27,6 @@ def parse_email_line(line):
name, addr = email.utils.parseaddr(line) if '@' in line else (line, '')
return dict(name=name, email=addr)
@python_2_unicode_compatible
class Submission(models.Model):
state = ForeignKey(DraftSubmissionStateName)
remote_ip = models.CharField(max_length=100, blank=True)
@ -76,7 +74,6 @@ class Submission(models.Model):
checks = [ self.checks.filter(checker=c).latest('time') for c in self.checks.values_list('checker', flat=True).distinct() ]
return checks
@python_2_unicode_compatible
class SubmissionCheck(models.Model):
time = models.DateTimeField(default=datetime.datetime.now)
submission = ForeignKey(Submission, related_name='checks')
@ -95,7 +92,6 @@ class SubmissionCheck(models.Model):
def has_errors(self):
return self.errors != '[]'
@python_2_unicode_compatible
class SubmissionEvent(models.Model):
submission = ForeignKey(Submission)
time = models.DateTimeField(default=datetime.datetime.now)
@ -109,7 +105,6 @@ class SubmissionEvent(models.Model):
ordering = ("-time", "-id")
@python_2_unicode_compatible
class Preapproval(models.Model):
"""Pre-approved draft submission name."""
name = models.CharField(max_length=255, db_index=True)
@ -119,7 +114,6 @@ class Preapproval(models.Model):
def __str__(self):
return self.name
@python_2_unicode_compatible
class SubmissionEmailEvent(SubmissionEvent):
message = ForeignKey(Message, null=True, blank=True,related_name='manualevents')
msgtype = models.CharField(max_length=25)

View file

@ -47,7 +47,6 @@ from bs4 import BeautifulSoup
import django.test
from django.conf import settings
from django.utils.encoding import python_2_unicode_compatible
from django.utils.text import slugify
import debug # pyflakes:ignore
@ -98,7 +97,6 @@ class ReverseLazyTest(django.test.TestCase):
response = self.client.get('/ipr/update/')
self.assertRedirects(response, "/ipr/", status_code=301)
@python_2_unicode_compatible
class TestCase(django.test.TestCase):
"""
Does basically the same as django.test.TestCase, but adds asserts for html5 validation.

Binary file not shown.