Skip to content

Commit f760caa

Browse files
committed
Cleaned away unused code
- Legacy-Id: 2065
1 parent cc13817 commit f760caa

15 files changed

Lines changed: 6 additions & 158 deletions

File tree

ietf/idindex/views.py

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from django.http import HttpResponse, HttpResponsePermanentRedirect
3636
from django.template import loader
3737
from django.shortcuts import get_object_or_404
38-
from ietf.idtracker.models import Acronym, IETFWG, InternetDraft, Rfc, IDInternal
38+
from ietf.idtracker.models import Acronym, IETFWG, InternetDraft, IDInternal
3939

4040
def all_id_txt():
4141
all_ids = InternetDraft.objects.order_by('filename')
@@ -73,54 +73,6 @@ def test_id_index_txt(request):
7373
def test_id_abstracts_txt(request):
7474
return HttpResponse(id_abstracts_txt(), mimetype='text/plain')
7575

76-
def related_docs(startdoc):
77-
related = []
78-
processed = []
79-
80-
def handle(otherdoc,status,doc,skip=(0,0,0)):
81-
new = (otherdoc, status, doc)
82-
if otherdoc in processed:
83-
return
84-
related.append(new)
85-
process(otherdoc,skip)
86-
87-
def process(doc, skip=(0,0,0)):
88-
processed.append(doc)
89-
if type(doc) == InternetDraft:
90-
if doc.replaced_by_id != 0 and not(skip[0]):
91-
handle(doc.replaced_by, "that replaces", doc, (0,1,0))
92-
if not(skip[1]):
93-
for replaces in doc.replaces_set.all():
94-
handle(replaces, "that was replaced by", doc, (1,0,0))
95-
if doc.rfc_number != 0 and not(skip[0]):
96-
# should rfc be an FK in the model?
97-
try:
98-
handle(Rfc.objects.get(rfc_number=doc.rfc_number), "which came from", doc, (1,0,0))
99-
# In practice, there are missing rows in the RFC table.
100-
except Rfc.DoesNotExist:
101-
pass
102-
if type(doc) == Rfc:
103-
if not(skip[0]):
104-
try:
105-
draft = InternetDraft.objects.get(rfc_number=doc.rfc_number)
106-
handle(draft, "that was published as", doc, (0,0,1))
107-
except InternetDraft.DoesNotExist:
108-
pass
109-
# The table has multiple documents published as the same RFC.
110-
# This raises an AssertionError because using get
111-
# presumes there is exactly one.
112-
except AssertionError:
113-
pass
114-
if not(skip[1]):
115-
for obsoleted_by in doc.updated_or_obsoleted_by.all():
116-
handle(obsoleted_by.rfc, "that %s" % obsoleted_by.action.lower(), doc)
117-
if not(skip[2]):
118-
for obsoletes in doc.updates_or_obsoletes.all():
119-
handle(obsoletes.rfc_acted_on, "that was %s by" % obsoletes.action.lower().replace("tes", "ted"), doc)
120-
121-
process(startdoc, (0,0,0))
122-
return related
123-
12476
def redirect_id(request, object_id):
12577
'''Redirect from historical document ID to preferred filename url.'''
12678
doc = get_object_or_404(InternetDraft, id_document_tag=object_id)

ietf/idrfc/idrfc_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3131
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232

33-
from ietf.idtracker.models import InternetDraft, IDInternal, BallotInfo, IESGDiscuss, IESGComment, IESGLogin
33+
from ietf.idtracker.models import InternetDraft, IDInternal, BallotInfo, IESGDiscuss, IESGLogin
3434
from ietf.idrfc.models import RfcEditorQueue
3535
import re
3636
from datetime import date

ietf/idtracker/models.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ def displayname(self):
160160
else:
161161
css="active"
162162
return '<span class="' + css + '">' + self.filename + '</span>'
163-
def displayname_current(self):
164-
if self.status.status == "Replaced":
165-
css="replaced"
166-
else:
167-
css="active"
168-
return '<span class="%s">%s-%s</span>' % (css, self.filename, self.revision)
169163
def displayname_with_link(self):
170164
if self.status.status == "Replaced":
171165
css="replaced"
@@ -174,8 +168,6 @@ def displayname_with_link(self):
174168
return '<a class="' + css + '" href="%s">%s</a>' % ( self.doclink(), self.filename )
175169
def doclink(self):
176170
return "http://" + settings.TOOLS_SERVER + "/html/%s" % ( self.filename )
177-
def doclink_current(self):
178-
return "http://%s/html/%s-%s" % (settings.TOOLS_SERVER, self.filename, self.revision)
179171
def group_acronym(self):
180172
return self.group.acronym
181173
def __str__(self):

ietf/idtracker/templatetags/ietf_filters.py

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

33
import textwrap
4-
import django
54
from django import template
65
from django.utils.html import escape, fix_ampersands
76
from django.template.defaultfilters import linebreaksbr, wordwrap, stringfilter
@@ -92,26 +91,6 @@ def make_one_per_line(value):
9291
else:
9392
return value
9493

95-
@register.filter(name='link_if_url')
96-
def link_if_url(value):
97-
"""
98-
If the argument looks like a url, return a link; otherwise, just
99-
return the argument."""
100-
if (re.match('(https?|mailto):', value)):
101-
return "<a href=\"%s\">%s</a>" % ( fix_ampersands(value), escape(value) )
102-
else:
103-
return escape(value)
104-
105-
# This replicates the nwg_list.cgi method.
106-
# It'd probably be better to check for the presence of
107-
# a scheme with a better RE.
108-
@register.filter(name='add_scheme')
109-
def add_scheme(value):
110-
if (re.match('www', value)):
111-
return "http://" + value
112-
else:
113-
return value
114-
11594
@register.filter(name='timesum')
11695
def timesum(value):
11796
"""
@@ -171,11 +150,6 @@ def fill(text, width):
171150
wrapped.append(para)
172151
return "\n\n".join(wrapped)
173152

174-
@register.filter(name='allononeline')
175-
def allononeline(text):
176-
"""Simply removes CRs, LFs, leading and trailing whitespace from the given string."""
177-
return text.replace("\r", "").replace("\n", "").strip()
178-
179153
@register.filter(name='allononelinew')
180154
def allononelinew(text):
181155
"""Map runs of whitespace to a single space and strip leading and trailing whitespace from the given string."""
@@ -374,4 +348,3 @@ def _test():
374348
if __name__ == "__main__":
375349
_test()
376350

377-

ietf/idtracker/views.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,12 @@
66
from django.template import RequestContext
77
from django.shortcuts import get_object_or_404, render_to_response
88
from django.db.models import Q
9-
from django.core.urlresolvers import reverse
109
from django.views.generic.list_detail import object_detail, object_list
1110
from ietf.idtracker.models import InternetDraft, IDInternal, IDState, IDSubState, Rfc, DocumentWrapper
1211
from ietf.idtracker.forms import IDSearch
1312
from ietf.utils import normalize_draftname
1413
import re
1514

16-
# Override default form field mappings
17-
# group_acronym: CharField(max_length=10)
18-
# note: CharField(max_length=100)
19-
def myfields(f):
20-
if f.name == "group":
21-
return forms.CharField(max_length=10,
22-
widget=forms.TextInput(attrs={'size': 5}))
23-
if f.name == "note":
24-
return forms.CharField(max_length=100,
25-
widget=forms.TextInput(attrs={'size': 100}))
26-
return f.formfield()
27-
2815
def search(request):
2916
# for compatability with old tracker form, which has
3017
# "all substates" = 6.
@@ -219,4 +206,3 @@ def view_comment(*args, **kwargs):
219206
def view_ballot(*args, **kwargs):
220207
return object_detail(*args, **kwargs)
221208

222-
# changes done by convert-096.py:changed newforms to forms

ietf/ietfauth/auth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
from django.contrib.auth.backends import RemoteUserBackend
3636
from django.contrib.auth.models import Group
3737
from ietf.idtracker.models import IESGLogin, Role, PersonOrOrgInfo
38-
from ietf.ietfauth.models import LegacyWgPassword, IetfUserProfile
38+
from ietf.ietfauth.models import IetfUserProfile
3939

4040
from ietf.utils import log
4141

ietf/ipr/new.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from ietf.utils.mail import send_mail
1515
from ietf.ipr.view_sections import section_table
1616
from ietf.idtracker.models import Rfc, InternetDraft
17-
import django
1817

1918
# ----------------------------------------------------------------
2019
# Create base forms from models

ietf/ipr/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3131
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3232

33-
import os, re
33+
import os
3434
import unittest
3535
from django.test.client import Client
3636
from django.conf import settings

ietf/mailinglists/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright The IETF Trust 2007, All Rights Reserved
22

33
from django.conf.urls.defaults import patterns
4-
from ietf.idtracker.models import Area, IETFWG
4+
from ietf.idtracker.models import IETFWG
55

66
urlpatterns = patterns('django.views.generic.list_detail',
77
(r'^wg/$', 'object_list', { 'queryset': IETFWG.objects.filter(email_archive__startswith='http'), 'template_name': 'mailinglists/wgwebmail_list.html' }),

ietf/middleware.py

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

3-
try:
4-
import tidy
5-
tidyavail = True
6-
except ImportError:
7-
tidyavail = False
83
from django.db import connection
94
from django.shortcuts import render_to_response
105
from django.template import RequestContext
@@ -15,30 +10,6 @@
1510
import sys
1611
import traceback
1712

18-
options = dict(
19-
output_xhtml=True,
20-
# add_xml_decl=True,
21-
# doctype='transitional',
22-
indent=True,
23-
tidy_mark=False,
24-
# hide_comments=True,
25-
wrap=100)
26-
27-
28-
class PrettifyMiddleware(object):
29-
"""Prettify middleware
30-
From http://www.djangosnippets.org/snippets/172/
31-
Uses python-utidylib, http://utidylib.berlios.de/,
32-
which uses HTML Tidy, http://tidy.sourceforge.net/
33-
"""
34-
35-
def process_response(self, request, response):
36-
if tidyavail and response.headers['Content-Type'].split(';', 1)[0] in ['text/html']:
37-
content = response.content
38-
content = str(tidy.parseString(content, **options))
39-
response.content = content
40-
return response
41-
4213
class SQLLogMiddleware(object):
4314
def process_response(self, request, response):
4415
for q in connection.queries:

0 commit comments

Comments
 (0)