Skip to content

Commit 2467832

Browse files
committed
Merged in some Django 1.0 related fixes plus conversion script from Pasi. Merged in menubar link fixes from Chris. Merged in abstract generation scripts from Jelte.
- Legacy-Id: 1605
1 parent 8869468 commit 2467832

36 files changed

Lines changed: 252 additions & 89 deletions

changelog

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,31 @@
1+
ietfdb (2.29)
2+
3+
* New script bin/abstracts.py, intended to be run as a cronjob, to generate
4+
the ID abstracts files. Merged in from Jelte.
5+
6+
* Fixed bug in wg-dir.html to support additional area URLs properly.
7+
From Chris.
8+
9+
* Added new rfcurl filter to eliminate hardcoded references to RFC URLs
10+
primarily in the liaisons and drafts pages. From Chris.
11+
12+
* Fixed URLs that were broken or outdated by the IETF web page
13+
re-organization throughout the tree. In particular, references to
14+
html.charters in URLs, and old charter references. Including many
15+
broken links in leftmenu. From Chris.
16+
17+
* Some Django 1.0 related fixes plus conversion script. From Pasi.
18+
19+
-- Henrik Levkowetz <henrik@levkowetz.com> 25 Jul 2009 19:46:45 +0200
20+
121
ietfdb (2.28)
222

323
* Show full name in document comment log. From Pasi.
424

525
* Optimize meeting agenda page to use less SQL queries. From Pasi.
626

7-
* Include version in iesg/agenda/documents.txt. From Pasi.
8-
27+
* Include version in iesg/agenda/documents.txt. From Pasi.
28+
929
-- Henrik Levkowetz <henrik@levkowetz.com> 25 Jul 2009 14:38:41 +0200
1030

1131
ietfdb (2.27)

ietf/bin/convert-096.py

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
2+
# All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
3+
#
4+
# Redistribution and use in source and binary forms, with or without
5+
# modification, are permitted provided that the following conditions
6+
# are met:
7+
#
8+
# * Redistributions of source code must retain the above copyright
9+
# notice, this list of conditions and the following disclaimer.
10+
#
11+
# * Redistributions in binary form must reproduce the above
12+
# copyright notice, this list of conditions and the following
13+
# disclaimer in the documentation and/or other materials provided
14+
# with the distribution.
15+
#
16+
# * Neither the name of the Nokia Corporation and/or its
17+
# subsidiary(-ies) nor the names of its contributors may be used
18+
# to endorse or promote products derived from this software
19+
# without specific prior written permission.
20+
#
21+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32+
33+
from os.path import exists
34+
import os
35+
import re
36+
37+
def convert_py(file):
38+
print " Converting ", file
39+
inf = open(file)
40+
outf_name = file+'.tmp~'
41+
outf = open(outf_name, "w")
42+
fixes = {}
43+
for line in inf:
44+
if re.search("Field.*maxlength=\d", line):
45+
line = line.replace("maxlength=", "max_length=")
46+
fixes['changed maxlength to max_length'] = True
47+
if re.search("^\s*from django import newforms as forms\s*$", line):
48+
line = "from django import forms\n"
49+
fixes['changed newforms to forms'] = True
50+
if re.search("^\s*import django.newforms as forms\s*$", line):
51+
line = "from django import forms\n"
52+
fixes['changed newforms to forms'] = True
53+
if re.search("^\s*from django.core.validators import email_re\s*$", line):
54+
line = "from django.forms.fields import email_re\n"
55+
fixes['changed email_re import'] = True
56+
if re.search("ForeignKey.*raw_id_admin=True", line):
57+
line = re.sub(",\s*raw_id_admin=True", "", line)
58+
fixes['removed raw_id_admin'] = True
59+
if re.search("ForeignKey.*edit_inline=True", line):
60+
line = re.sub(",\s*edit_inline=True", "", line)
61+
fixes['removed edit_inline'] = True
62+
if re.search("ForeignKey.*edit_inline=models\.\w+", line):
63+
line = re.sub(",\s*edit_inline=models\.\w+", "", line)
64+
fixes['removed edit_inline'] = True
65+
if re.search("ForeignKey.*num_in_admin=\d+", line):
66+
line = re.sub(",\s*num_in_admin=\d+", "", line)
67+
fixes['removed num_in_admin'] = True
68+
if re.search("ForeignKey.*max_num_in_admin=\d+", line):
69+
line = re.sub(",\s*max_num_in_admin=\d+", "", line)
70+
fixes['removed max_num_in_admin'] = True
71+
if re.search("ManyToManyField.*filter_interface=models\.\w+", line):
72+
line = re.sub(",\s*filter_interface=models\.\w+", "", line)
73+
fixes['removed filter_interface'] = True
74+
if re.search("(Field|ForeignKey).*core=True", line):
75+
line = re.sub(",\s*core=True", "", line)
76+
fixes['removed core'] = True
77+
if re.search("\.clean_data", line):
78+
line = re.sub("\.clean_data", ".cleaned_data", line)
79+
fixes['cleaned_data'] = True
80+
outf.write(line)
81+
inf.close()
82+
fixes_list = fixes.keys()
83+
fixes_list.sort()
84+
something_fixed = len(fixes_list) > 0
85+
if something_fixed:
86+
outf.write("\n# changes done by convert-096.py:")
87+
outf.write("\n# ".join(fixes_list))
88+
outf.write("\n")
89+
outf.close()
90+
if something_fixed:
91+
os.rename(file, file+'.backup~')
92+
os.rename(outf_name, file)
93+
print " Fixes: "+", ".join(fixes_list)
94+
else:
95+
os.remove(outf_name)
96+
97+
if not exists("settings.py"):
98+
raise Exception("Please run this in directory containing settings.py")
99+
100+
for root, dirs, files in os.walk("."):
101+
if root.find(".svn") >= 0:
102+
continue
103+
print "Processing ", root
104+
for file in files:
105+
if file.endswith(".py"):
106+
convert_py(root+"/"+file)
107+
108+

ietf/idrfc/models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ class RfcEditorQueue(models.Model):
4141
(3, 'IRTF'),
4242
(4, 'Independent')
4343
)
44-
draft = models.OneToOneField(InternetDraft, db_column="id_document_tag", related_name="rfc_editor_queue_state")
45-
#draft = models.CharField(maxlength=200,primary_key=True)
44+
draft = models.OneToOneField(InternetDraft, db_column="id_document_tag", related_name="rfc_editor_queue_state",primary_key=True)
4645
date_received = models.DateField()
4746
state = models.CharField(maxlength=200, blank=True, null=True)
4847
# currently, queue2.xml does not have this information, so

ietf/idtracker/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ def public_comments(self):
588588
def comments(self):
589589
# would filter by rfc_flag but the database is broken. (see
590590
# trac ticket #96) so this risks collisions.
591-
return self.documentcomment_set.all().order_by('-comment_date','-comment_time','-id')
591+
return self.documentcomment_set.all().order_by('-date','-time','-id')
592592
def ballot_set(self):
593593
return IDInternal.objects.filter(ballot=self.ballot_id).order_by('-primary_flag')
594594
def ballot_primary(self):

ietf/idtracker/templatetags/ietf_filters.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Copyright The IETF Trust 2007, All Rights Reserved
22

33
import textwrap
4+
import django
45
from django import template
56
from django.utils.html import escape, fix_ampersands, linebreaks
67
from django.template.defaultfilters import linebreaksbr
@@ -199,6 +200,15 @@ def rfcnospace(string):
199200
else:
200201
return string
201202

203+
@register.filter(name='rfcurl')
204+
def rfclink(string):
205+
"""
206+
This takes just the RFC number, and turns it into the
207+
URL for that RFC.
208+
"""
209+
string = str(string);
210+
return "http://tools.ietf.org/html/rfc" + string;
211+
202212
@register.filter(name='dashify')
203213
def dashify(string):
204214
"""
@@ -311,6 +321,12 @@ def equal(x, y):
311321
def in_group(user, groups):
312322
return user and user.is_authenticated() and bool(user.groups.filter(name__in=groups.split(',')).values('name'))
313323

324+
# DJANGO_096: a dummy safe filter for Django 0.96
325+
if django.VERSION[0] == 0:
326+
@register.filter
327+
def safe(x):
328+
return x
329+
314330
def _test():
315331
import doctest
316332
doctest.testmod()

ietf/idtracker/views.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def search(request):
7676
if status != '':
7777
q_objs.append(Q(draft__status=status,rfc_flag=0))
7878
matches = IDInternal.objects.all().filter(*q_objs)
79-
matches = matches.order_by('cur_state', 'cur_sub_state', 'ballot_id', '-primary_flag')
79+
matches = matches.order_by('cur_state', 'cur_sub_state', 'ballot', '-primary_flag')
8080
# sort by date in reverse
8181
# first build docstate groups, within which we sort
8282
# in each docstate group, we build ballot id groups, which we sort
@@ -207,11 +207,11 @@ def send_email(request):
207207
context_instance=RequestContext(request))
208208

209209
def status(request):
210-
queryset = IDInternal.objects.filter(primary_flag=1).exclude(cur_state__state__in=('RFC Ed Queue', 'RFC Published', 'AD is watching', 'Dead')).order_by('cur_state', 'status_date', 'ballot_id')
210+
queryset = IDInternal.objects.filter(primary_flag=1).exclude(cur_state__state__in=('RFC Ed Queue', 'RFC Published', 'AD is watching', 'Dead')).order_by('cur_state', 'status_date', 'ballot')
211211
return object_list(request, template_name="idtracker/status_of_items.html", queryset=queryset, extra_context={'title': 'IESG Status of Items'})
212212

213213
def last_call(request):
214-
queryset = IDInternal.objects.filter(primary_flag=1).filter(cur_state__state__in=('In Last Call', 'Waiting for Writeup', 'Waiting for AD Go-Ahead')).order_by('cur_state', 'status_date', 'ballot_id')
214+
queryset = IDInternal.objects.filter(primary_flag=1).filter(cur_state__state__in=('In Last Call', 'Waiting for Writeup', 'Waiting for AD Go-Ahead')).order_by('cur_state', 'status_date', 'ballot')
215215
return object_list(request, template_name="idtracker/status_of_items.html", queryset=queryset, extra_context={'title': 'Documents in Last Call', 'lastcall': 1})
216216

217217
def redirect_id(request, object_id):

ietf/iesg/views.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ def agenda_docs(date, next_agenda):
117117
matches = IDInternal.objects.filter(telechat_date=date, primary_flag=1, agenda=1)
118118
else:
119119
matches = IDInternal.objects.filter(telechat_date=date, primary_flag=1)
120-
idmatches = matches.filter(rfc_flag=0).order_by('ballot_id')
121-
rfcmatches = matches.filter(rfc_flag=1).order_by('ballot_id')
120+
idmatches = matches.filter(rfc_flag=0).order_by('ballot')
121+
rfcmatches = matches.filter(rfc_flag=1).order_by('ballot')
122122
res = {}
123123
for id in list(idmatches)+list(rfcmatches):
124124
section_key = "s"+get_doc_section(id)
@@ -212,8 +212,8 @@ def telechat_agenda_documents(request):
212212
telechats = []
213213
for date in dates:
214214
matches = IDInternal.objects.filter(telechat_date=date,primary_flag=1,agenda=1)
215-
idmatches = matches.filter(rfc_flag=0).order_by('ballot_id')
216-
rfcmatches = matches.filter(rfc_flag=1).order_by('ballot_id')
215+
idmatches = matches.filter(rfc_flag=0).order_by('ballot')
216+
rfcmatches = matches.filter(rfc_flag=1).order_by('ballot')
217217
res = {}
218218
for id in list(idmatches)+list(rfcmatches):
219219
section_key = "s"+get_doc_section(id)

ietf/templates/idindex/doclist.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{# Copyright The IETF Trust 2007, All Rights Reserved #}
2+
{% load ietf_filters %}
23
<!-- {{ object_list|length }} result{{ object_list|length|pluralize }}.<br> -->
34
<b>Please click a document below to view detail information,
45
or the [draft] link for the document itself.</b><br>
@@ -29,7 +30,7 @@
2930
{% else %}
3031
<td>
3132
{% if draft.rfc_number %}
32-
<a href="http://www.ietf.org/rfc/rfc{{ draft.rfc_number|stringformat:"04d" }}.txt">{{ draft.rfc_number }}</a>
33+
<a href="{{ draft.rfc_number|rfcurl }}">{{ draft.rfc_number }}</a>
3334
{% else %}
3435
&nbsp;
3536
{% endif %}

ietf/templates/idindex/internetdraft_detail.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{# Copyright The IETF Trust 2007, All Rights Reserved #}
2-
{% extends "idindex/base.html" %}
2+
{% extends "idindex/base.html" %}{% load ietf_filters %}
33

44
{% block title %}Internet Draft Database Index - {{ object.filename }}{% endblock %}
55

@@ -13,7 +13,7 @@ <h2>{{ object.filename }}-{{ object.revision_display }}</h2>
1313
<li> <b><a href="related/">View Related Documents</a></b> (e.g., documents that replaced or were replaced by the subject I-D, and their derivatives and precursors.)</li>
1414
{% ifequal object.group.acronym "none" %}
1515
{% else %}
16-
<li> <b>IETF Working Group: <a href="http://www.ietf.org/html.charters/{{ object.group.acronym }}-charter.html">{{ object.group.name }}</a></li>
16+
<li> <b>IETF Working Group: <a href="http://www.ietf.org/dyn/wg/charter/{{ object.group.acronym }}-charter.html">{{ object.group.name }}</a></li>
1717
{% endifequal %}
1818
<li> <b>I-D Title:</b> {{ object.title }}</li>
1919
<li> <b>I-D Status:</b> {{ object.status }}
@@ -25,7 +25,7 @@ <h2>{{ object.filename }}-{{ object.revision_display }}</h2>
2525
{% endif %}
2626
</li>
2727
<li> <b>I-D Intended Status at Publication:</b> {{ object.intended_status }}</li>
28-
<li> <b>RFC Number:</b> {% if object.rfc_number %}<a href="http://www.ietf.org/rfc/rfc{{ object.rfc_number }}.txt">{{ object.rfc_number }}</a>{% endif %}</li>
28+
<li> <b>RFC Number:</b> {% if object.rfc_number %}<a href="{{ object.rfc_number|rfcurl }}">{{ object.rfc_number }}</a>{% endif %}</li>
2929
<li> <b><a href="{% url ietf.idtracker.views.search %}">I-D Tracker</a> State:</b>
3030
{% if object.idtracker %}
3131
<a href="/idtracker/{{ object.filename }}/">{{ object.idstate }}</a>

ietf/templates/idrfc/by_ad.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{% extends "idrfc/base.html" %}
12
{% comment %}
23
Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
34
All rights reserved. Contact: Pasi Eronen <pasi.eronen@nokia.com>
@@ -32,7 +33,6 @@
3233
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3334
{% endcomment %}
3435

35-
{% extends "idrfc/base.html" %}
3636

3737
{% block title %}Internet-Drafts and RFCs for {{ ad_name }}
3838
{% endblock %}

0 commit comments

Comments
 (0)