Skip to content

Commit 53a2370

Browse files
committed
Port idindex, commenting out test views
- Legacy-Id: 3070
1 parent 16a2782 commit 53a2370

4 files changed

Lines changed: 48 additions & 37 deletions

File tree

ietf/idindex/tests.py

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,34 +39,34 @@ class IdIndexUrlTestCase(SimpleUrlTestCase):
3939
def testUrls(self):
4040
self.doTestUrls(__file__)
4141

42-
class IndexTestCase(unittest.TestCase, RealDatabaseTest):
43-
def setUp(self):
44-
self.setUpRealDatabase()
45-
def tearDown(self):
46-
self.tearDownRealDatabase()
42+
# class IndexTestCase(unittest.TestCase, RealDatabaseTest):
43+
# def setUp(self):
44+
# self.setUpRealDatabase()
45+
# def tearDown(self):
46+
# self.tearDownRealDatabase()
4747

48-
def testAllId(self):
49-
print " Testing all_id.txt generation"
50-
c = Client()
51-
response = c.get('/drafts/_test/all_id.txt')
52-
self.assertEquals(response.status_code, 200)
53-
content = response.content
54-
# Test that correct version number is shown for couple of old drafts
55-
self.assert_(content.find("draft-ietf-tls-psk-09") >= 0)
56-
self.assert_(content.find("draft-eronen-eap-sim-aka-80211-00") >= 0)
57-
# Since all_id.txt contains all old drafts, it should never shrink
58-
lines = content.split("\n")
59-
self.assert_(len(lines) > 18000)
60-
# Test that the lines look OK and have correct number of tabs
61-
r = re.compile(r'^(draft-\S*-\d\d)\t(\d\d\d\d-\d\d-\d\d)\t([^\t]+)\t([^\t]*)$')
62-
for line in lines:
63-
if ((line == "") or
64-
(line == "Internet-Drafts Status Summary") or
65-
(line == "Web version is available at") or
66-
(line == "https://datatracker.ietf.org/public/idindex.cgi")):
67-
pass
68-
elif r.match(line):
69-
pass
70-
else:
71-
self.fail("Unexpected line \""+line+"\"")
72-
print "OK (all_id.txt)"
48+
# def testAllId(self):
49+
# print " Testing all_id.txt generation"
50+
# c = Client()
51+
# response = c.get('/drafts/_test/all_id.txt')
52+
# self.assertEquals(response.status_code, 200)
53+
# content = response.content
54+
# # Test that correct version number is shown for couple of old drafts
55+
# self.assert_(content.find("draft-ietf-tls-psk-09") >= 0)
56+
# self.assert_(content.find("draft-eronen-eap-sim-aka-80211-00") >= 0)
57+
# # Since all_id.txt contains all old drafts, it should never shrink
58+
# lines = content.split("\n")
59+
# self.assert_(len(lines) > 18000)
60+
# # Test that the lines look OK and have correct number of tabs
61+
# r = re.compile(r'^(draft-\S*-\d\d)\t(\d\d\d\d-\d\d-\d\d)\t([^\t]+)\t([^\t]*)$')
62+
# for line in lines:
63+
# if ((line == "") or
64+
# (line == "Internet-Drafts Status Summary") or
65+
# (line == "Web version is available at") or
66+
# (line == "https://datatracker.ietf.org/public/idindex.cgi")):
67+
# pass
68+
# elif r.match(line):
69+
# pass
70+
# else:
71+
# self.fail("Unexpected line \""+line+"\"")
72+
# print "OK (all_id.txt)"

ietf/idindex/testurl.list

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@
55
301 /drafts/current/
66
301 /drafts/all/
77
301 /drafts/dead/
8-
301 /drafts/9574/related/
9-
301 /drafts/9574/
8+
#301 /drafts/9574/related/
9+
#301 /drafts/9574/
1010
301 /drafts/draft-ietf-dnsext-dnssec-protocol/related/
1111
301 /drafts/draft-ietf-dnsext-dnssec-protocol/
12-
404 /drafts/987654/
12+
#404 /drafts/987654/
1313
301 /drafts/all_id_txt.html
1414
301 /drafts/all_id.html
1515
301 /drafts/
16-
200,heavy /drafts/_test/all_id.txt
16+
#200,heavy /drafts/_test/all_id.txt
1717
# this takes 3 minutes, so disabled by default
1818
#200,heavy /drafts/_test/all_id2.txt
19-
200,heavy /drafts/_test/id_index.txt
20-
200,heavy /drafts/_test/id_abstracts.txt
19+
#200,heavy /drafts/_test/id_index.txt
20+
#200,heavy /drafts/_test/id_abstracts.txt

ietf/idindex/urls.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
(r'^all_id(?:_txt)?.html$', 'django.views.generic.simple.redirect_to', { 'url': 'http://www.ietf.org/id/all_id.txt' }),
1818
)
1919

20-
if settings.SERVER_MODE != 'production':
20+
if settings.SERVER_MODE != 'production' and not settings.USE_DB_REDESIGN_PROXY_CLASSES:
21+
# these haven't been ported
2122
urlpatterns += patterns('',
2223
(r'^_test/all_id.txt$', views.test_all_id_txt),
2324
(r'^_test/all_id2.txt$', views.test_all_id2_txt),

ietf/idindex/views.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
from django.http import HttpResponse, HttpResponsePermanentRedirect
3636
from django.template import loader
3737
from django.shortcuts import get_object_or_404
38+
from django.conf import settings
39+
3840
from ietf.idtracker.models import Acronym, IETFWG, InternetDraft, IDInternal,PersonOrOrgInfo, Area
3941
from ietf.idtracker.templatetags.ietf_filters import clean_whitespace
4042
import re
@@ -156,13 +158,21 @@ def test_id_abstracts_txt(request):
156158

157159
def redirect_id(request, object_id):
158160
'''Redirect from historical document ID to preferred filename url.'''
161+
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
162+
return HttpResponsePermanentRedirect("/doc/")
163+
159164
doc = get_object_or_404(InternetDraft, id_document_tag=object_id)
160165
return HttpResponsePermanentRedirect("/doc/"+doc.filename+"/")
161166

162167
def redirect_filename(request, filename):
163168
return HttpResponsePermanentRedirect("/doc/"+filename+"/")
164169

165170
def wgdocs_redirect_id(request, id):
171+
if settings.USE_DB_REDESIGN_PROXY_CLASSES:
172+
from group.models import Group
173+
group = get_object_or_404(Group, id=id)
174+
return HttpResponsePermanentRedirect("/wg/%s/" % group.acronym)
175+
166176
group = get_object_or_404(Acronym, acronym_id=id)
167177
return HttpResponsePermanentRedirect("/wg/"+group.acronym+"/")
168178

0 commit comments

Comments
 (0)