Skip to content

Commit 14776ba

Browse files
committed
Merged django18 work forward to r12447
- Legacy-Id: 12455
2 parents 486e394 + 3b6f30f commit 14776ba

22 files changed

Lines changed: 191 additions & 170 deletions

File tree

ietf/dbtemplate/template.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from docutils.utils import SystemMessage
55
import debug # pyflakes:ignore
66

7-
from django.template import Template as DjangoTemplate, TemplateDoesNotExist, TemplateEncodingError
7+
from django.template.base import Template as DjangoTemplate, TemplateDoesNotExist, TemplateEncodingError
88
from django.template.loader import BaseLoader
99
from django.utils.encoding import smart_unicode
1010

ietf/doc/models.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import datetime, os
44

55
from django.db import models
6+
from django.core import checks
67
from django.core.exceptions import ValidationError
78
from django.core.urlresolvers import reverse as urlreverse
89
from django.core.validators import URLValidator
@@ -26,6 +27,20 @@ class StateType(models.Model):
2627
def __unicode__(self):
2728
return self.slug
2829

30+
@checks.register('db-consistency')
31+
def check_statetype_slugs(app_configs, **kwargs):
32+
errors = []
33+
state_type_slugs = [ t.slug for t in StateType.objects.all() ]
34+
for type in DocTypeName.objects.all():
35+
if not type.slug in state_type_slugs:
36+
errors.append(checks.Error(
37+
"The document type '%s (%s)' does not have a corresponding entry in the doc.StateType table" % (type.name, type.slug),
38+
hint="You should add a doc.StateType entry with a slug '%s' to match the DocTypeName slug."%(type.slug),
39+
obj=type,
40+
id='datatracker.doc.E0015',
41+
))
42+
return errors
43+
2944
class State(models.Model):
3045
type = models.ForeignKey(StateType)
3146
slug = models.SlugField()
@@ -53,7 +68,7 @@ class DocumentInfo(models.Model):
5368
title = models.CharField(max_length=255)
5469

5570
states = models.ManyToManyField(State, blank=True) # plain state (Active/Expired/...), IESG state, stream state
56-
tags = models.ManyToManyField(DocTagName, blank=True, null=True) # Revised ID Needed, ExternalParty, AD Followup, ...
71+
tags = models.ManyToManyField(DocTagName, blank=True) # Revised ID Needed, ExternalParty, AD Followup, ...
5772
stream = models.ForeignKey(StreamName, blank=True, null=True) # IETF, IAB, IRTF, Independent Submission
5873
group = models.ForeignKey(Group, blank=True, null=True) # WG, RG, IAB, IESG, Edu, Tools
5974

@@ -277,7 +292,7 @@ def relations_that(self, relationship):
277292
if isinstance(self, Document):
278293
return RelatedDocument.objects.filter(target__document=self, relationship__in=relationship).select_related('source')
279294
elif isinstance(self, DocHistory):
280-
return RelatedDocHistory.objects.filter(target__document=self, relationship__in=relationship).select_related('source')
295+
return RelatedDocHistory.objects.filter(target__document=self.doc, relationship__in=relationship).select_related('source')
281296
else:
282297
return RelatedDocument.objects.none()
283298

ietf/doc/templatetags/ietf_filters.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ietf.doc.utils import get_document_content
1414
from django import template
1515
from django.conf import settings
16-
from django.utils.html import escape, fix_ampersands
16+
from django.utils.html import escape
1717
from django.template.defaultfilters import truncatewords_html, linebreaksbr, stringfilter, striptags, urlize
1818
from django.template import resolve_variable
1919
from django.utils.safestring import mark_safe, SafeData
@@ -69,7 +69,7 @@ def parse_email_list(value):
6969
(name, email) = parseaddr(addr)
7070
if not(name):
7171
name = email
72-
ret.append('<a href="mailto:%s">%s</a>' % ( fix_ampersands(email), escape(name) ))
72+
ret.append('<a href="mailto:%s">%s</a>' % ( email.replace('&', '&amp;'), escape(name) ))
7373
return mark_safe(", ".join(ret))
7474
else:
7575
return value

ietf/doc/utils_search.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def fill_in_document_table_attributes(docs):
1212
docs_dict = dict((d.pk, d) for d in docs)
1313
doc_ids = docs_dict.keys()
1414

15-
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc", document__in=doc_ids).values_list("document_id", "name"))
15+
rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc", document__in=doc_ids).values_list("document", "name"))
1616

1717
# latest event cache
1818
event_types = ("published_rfc",
@@ -79,9 +79,9 @@ def fill_in_document_table_attributes(docs):
7979
d.updated_by_list = []
8080

8181
xed_by = RelatedDocument.objects.filter(target__name__in=rfc_aliases.values(),
82-
relationship__in=("obs", "updates")).select_related('target__document_id')
82+
relationship__in=("obs", "updates")).select_related('target__document')
8383
rel_rfc_aliases = dict(DocAlias.objects.filter(name__startswith="rfc",
84-
document__in=[rel.source_id for rel in xed_by]).values_list('document_id', 'name'))
84+
document__in=[rel.source_id for rel in xed_by]).values_list('document', 'name'))
8585
for rel in xed_by:
8686
d = docs_dict[rel.target.document_id]
8787
if rel.relationship_id == "obs":
@@ -101,7 +101,7 @@ def prepare_document_table(request, docs, query=None, max_results=500):
101101
if not isinstance(docs, list):
102102
# evaluate and fill in attribute results immediately to decrease
103103
# the number of queries
104-
docs = docs.select_related("ad", "ad__person", "std_level", "intended_std_level", "group", "stream")
104+
docs = docs.select_related("ad", "std_level", "intended_std_level", "group", "stream")
105105
docs = docs.prefetch_related("states__type", "tags", "groupmilestone_set__group", "reviewrequest_set__team")
106106

107107
docs = list(docs[:max_results])

ietf/doc/views_material.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class UploadMaterialForm(forms.Form):
3838
def __init__(self, doc_type, action, group, doc, *args, **kwargs):
3939
super(UploadMaterialForm, self).__init__(*args, **kwargs)
4040

41-
self.fields["state"].queryset = self.fields["state"].queryset.filter(type=doc_type)
41+
self.fields["state"].queryset = self.fields["state"].queryset.filter(type__slug=doc_type.slug)
4242

4343
self.doc_type = doc_type
4444
self.action = action

ietf/liaisons/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class LiaisonStatement(models.Model):
4040
other_identifiers = models.TextField(blank=True, null=True) # Identifiers from other bodies
4141
body = models.TextField(blank=True)
4242

43-
tags = models.ManyToManyField(LiaisonStatementTagName, blank=True, null=True)
43+
tags = models.ManyToManyField(LiaisonStatementTagName, blank=True)
4444
attachments = models.ManyToManyField(Document, through='LiaisonStatementAttachment', blank=True)
4545
state = models.ForeignKey(LiaisonStatementState, default='pending')
4646

@@ -212,7 +212,7 @@ def __unicode__(self):
212212

213213

214214
class LiaisonStatementGroupContacts(models.Model):
215-
group = models.ForeignKey(Group, unique=True)
215+
group = models.ForeignKey(Group, unique=True, null=True)
216216
contacts = models.CharField(max_length=255,blank=True)
217217
cc_contacts = models.CharField(max_length=255,blank=True)
218218

ietf/mailtrigger/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ def clean_duplicates(addrlist):
2222
class MailTrigger(models.Model):
2323
slug = models.CharField(max_length=32, primary_key=True)
2424
desc = models.TextField(blank=True)
25-
to = models.ManyToManyField('Recipient', null=True, blank=True, related_name='used_in_to')
26-
cc = models.ManyToManyField('Recipient', null=True, blank=True, related_name='used_in_cc')
25+
to = models.ManyToManyField('Recipient', blank=True, related_name='used_in_to')
26+
cc = models.ManyToManyField('Recipient', blank=True, related_name='used_in_cc')
2727

2828
class Meta:
2929
ordering = ["slug"]
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[
2+
{
3+
"fields": {
4+
"group": 1,
5+
"title": "IETF 97 Proceedings Overview",
6+
"variables": null,
7+
"content": "The Internet Engineering Task Force (IETF) provides a forum for working groups to coordinate technical development of new protocols. Its most important function is the development and selection of standards within the Internet protocol suite.\n\nThe IETF began in January 1986 as a forum for technical coordination by contractors for the then US Defense Advanced Research Projects Agency (DARPA), working on the ARPANET, US Defense Data Network (DDN), and the Internet core gateway system. Since that time, the IETF has grown into a large open international community of network designers, operators, vendors, and researchers concerned with the evolution of the Internet architecture and the smooth operation of the Internet.\n\nThe IETF mission includes:\n\n* Identifying and proposing solutions to pressing operational and technical problems in the Internet\n* Specifying the development or usage of protocols and the near-term architecture, to solve technical problems for the Internet\n* Facilitating technology transfer from the Internet Research Task Force (IRTF) to the wider Internet community;and\n* Providing a forum for the exchange of relevant information within the Internet community between vendors, users, researchers, agency contractors, and network managers.\n\nTechnical activities in the IETF are addressed within working groups. All working groups are organized roughly by function into seven areas. Each area is led by one or more Area Directors who have primary responsibility for that one area of IETF activity. Together with the Chair of the IETF/IESG, these Area Directors comprise the Internet Engineering Steering Group (IESG).\n\n=================== =================================== ========================\nName Area Email\n=================== =================================== ========================\nJari Arkko IETF Chair chair@ietf.org\nJari Arkko General Area jari.arkko@piuha.net\nAlia Atlas Routing Area akatlas@gmail.com\nDeborah Brungard Routing Areas db3546@att.com\nBen Campbell Applications and Real-Time Area ben@nostrum.com\nBenoit Claise Operations and Management Area bclaise@cisco.com\nAlissa Cooper Applications and Real-Time Area alissa@cooperw.in\nSpencer Dawkins Transport Area spencerdawkins.ietf@gmail.com\nStephen Farrell Security Area stephen.farrell@cs.tcd.ie\nJoel Jaeggli Operations and Management Area joelja@bogus.com\nSuresh Krishnan Internet Area suresh.krishnan@ericsson.com\nMirja Kühlewind Transport Area ietf@kuehlewind.net\nTerry Manderson Internet Area terry.manderson@icann.org\nAlexey Melnikov Applications and Real-Time Area aamelnikov@fastmail.fm\nKathleen Moriarty Security Area Kathleen.Moriarty.ietf@gmail.com\nAlvaro Retana Routing Area aretana@cisco.com\n=================== =================================== ========================\n\n\nLiaison and ex-officio members include:\n\n=================== =================================== ========================\nOlaf Kolkman IAB Chair iab-chair@iab.org\nDanny McPherson IAB Liaison danny@tcb.net\nMichelle Cotton IANA Liaison iana@iana.org\nSandy Ginoza RFC Editor Liaison rfc-editor@rfc-editor.org\nAlexa Morris IETF Secretariat Liaison exec-director@ietf.org\n=================== =================================== ========================\n\n\nThe IETF has a Secretariat, which is managed by Association Management Solutions, LLC (AMS) in Fremont, California.The IETF Executive Director is Alexa Morris (exec-director@ietf.org).\n\n\nOther personnel that provide full-time support to the Secretariat include:\n\n========================= ===================================\nSenior Meeting Planner Marcia Beaulieu\nProject Manager Stephanie McCammon\nMeeting Regsitrar Maddy Conner\nProject Manager Cindy Morgan\nProject Manager Amy Vezza\n========================= ===================================\n\nTo contact the Secretariat, please refer to the addresses and URLs provided on the IETF Secretariat Web page.\n\nThe IETF also has a general Administrative Support Activity headed by the IETF Administrative Director, Ray Pelletier iad@ietf.org\n\nThe working groups conduct their business during the tri-annual IETF meetings, at interim working group meetings, and via electronic mail on mailing lists established for each group. The tri-annual IETF meetings are 4.5 days in duration, and consist of working group sessions, training sessions, and plenary sessions. The plenary sessions include technical presentations, status reports, and an open IESG meeting.\n\nFollowing each meeting, the IETF Secretariat publishes meeting proceedings, which contain reports from all of the groups that met, as well as presentation slides, where available. The proceedings also include a summary of the standards-related activities that took place since the previous IETF meeting.\n\nMeeting minutes, working group charters (including information about the working group mailing lists), and general information on current IETF activities are available on the IETF Web site at https://www.ietf.org.\n",
8+
"path": "/meeting/proceedings/defaults/overview.rst",
9+
"type": "rst"
10+
},
11+
"model": "dbtemplate.dbtemplate",
12+
"pk": 179
13+
},
14+
{
15+
"fields": {
16+
"order": 0,
17+
"used": true,
18+
"name": "reStructuredText",
19+
"desc": ""
20+
},
21+
"model": "name.dbtemplatetypename",
22+
"pk": "rst"
23+
},
24+
{
25+
"fields": {
26+
"charter": null,
27+
"unused_states": [],
28+
"description": "",
29+
"parent": null,
30+
"list_email": "",
31+
"acronym": "ietf",
32+
"comments": "",
33+
"list_subscribe": "",
34+
"state": "active",
35+
"time": "2012-02-26T00:21:36",
36+
"unused_tags": [],
37+
"list_archive": "",
38+
"type": "ietf",
39+
"name": "IETF"
40+
},
41+
"model": "group.group",
42+
"pk": 1
43+
},
44+
{
45+
"fields": {
46+
"order": 0,
47+
"used": true,
48+
"name": "Active",
49+
"desc": ""
50+
},
51+
"model": "name.groupstatename",
52+
"pk": "active"
53+
},
54+
{
55+
"fields": {
56+
"order": 0,
57+
"used": true,
58+
"verbose_name": "Internet Engineering Task Force",
59+
"name": "IETF",
60+
"desc": ""
61+
},
62+
"model": "name.grouptypename",
63+
"pk": "ietf"
64+
}
65+
]

0 commit comments

Comments
 (0)