Skip to content

Commit c03019a

Browse files
committed
Adding a page review facility under the URL /review/. This is based on frames and takes the URLs in question from the testurl.list files.
- Legacy-Id: 487
1 parent 7fa51e0 commit c03019a

5 files changed

Lines changed: 90 additions & 5 deletions

File tree

ietf/templates/utils/frame2.html

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
2+
"http://www.w3.org/TR/html4/frameset.dtd">
3+
<html>
4+
<head>
5+
<title>Comparison -- {{ info.old }} - {{ info.new }}</title>
6+
</head>
7+
<frameset rows="70, *">
8+
<frame src="../top/{{ info.this }}">
9+
<frameset cols="50%, 50%">
10+
<frame name="old" src="{{ info.old }}">
11+
<frame name="new" src="{{ info.new }}">
12+
</frameset>
13+
<noframes>
14+
<p>this frameset document contains:
15+
<ul>
16+
<li><a href="{{ info.old }}">The old page</a><li>
17+
<li><a href="{{ info.new }}">The new page</a><li>
18+
</ul>
19+
</noframes>
20+
</frameset>
21+
</html>

ietf/templates/utils/review.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
2+
"http://www.w3.org/TR/html4/frameset.dtd">
3+
<html>
4+
<head>
5+
<title>Comparison - {{ info.old }} / {{ info.new }}</title>
6+
</head>
7+
<body>
8+
<table width="100%" border="0" cellspacing="0" cellpadding="3">
9+
<tr>
10+
<td align="left">
11+
<a href="../../{{ info.prev }}" target="_top">&lt; Prev</a>
12+
<br /><br />
13+
<a href="{{ info.old }}" target="old">{{ info.old }}</a></td>
14+
<td align="center"></td>
15+
<td align="right">
16+
<a href="../../{{ info.next }}" target="_top">Next &gt;</a>
17+
<br /><br />
18+
<a href="{{ info.new }}" target="new">{{ info.new }}</a></td>
19+
</td>
20+
</tr>
21+
</table>
22+
</body>
23+
</html>

ietf/tests.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def read_testurls(filename):
8686
file.close()
8787
return tuples
8888

89+
def get_testurls():
90+
testtuples = []
91+
for root, dirs, files in os.walk(settings.BASE_DIR):
92+
if "testurl.list" in files:
93+
testtuples += read_testurls(root+"/testurl.list")
94+
if "testurls.list" in files:
95+
testtuples += read_testurls(root+"/testurls.list")
96+
return testtuples
97+
8998
def filetext(filename):
9099
file = open(filename)
91100
chunk = file.read()
@@ -110,11 +119,7 @@ def module_setup(module):
110119
module.testtuples = []
111120
module.testurls = []
112121
module.diffchunks = []
113-
for root, dirs, files in os.walk(settings.BASE_DIR):
114-
if "testurl.list" in files:
115-
module.testtuples += read_testurls(root+"/testurl.list")
116-
if "testurls.list" in files:
117-
module.testtuples += read_testurls(root+"/testurls.list")
122+
module.testtuples = get_testurls()
118123
module.testurls = [ tuple[1] for tuple in module.testtuples ]
119124

120125
# find diff chunks

ietf/urls.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from ietf.iesg.feeds import IESGMinutes
44
from ietf.idtracker.feeds import DocumentComments
55
from ietf.ipr.feeds import LatestIprDisclosures
6+
import ietf.utils.views
67
import ietf.views
78

89
feeds = {
@@ -30,4 +31,10 @@
3031

3132
# Uncomment this for admin:
3233
(r'^admin/', include('django.contrib.admin.urls')),
34+
35+
# Uncomment this for review pages:
36+
(r'^review/$', 'ietf.utils.views.review'),
37+
(r'^review/(?P<page>[0-9]+)/$', 'ietf.utils.views.review'),
38+
(r'^review/top/(?P<page>[0-9]+)/$', 'ietf.utils.views.top'),
39+
3340
)

ietf/utils/views.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from django.shortcuts import render_to_response as render
2+
3+
testurls = []
4+
urlcount = 0
5+
host = "merlot.tools.ietf.org:31415"
6+
7+
def get_info(page):
8+
global testurls
9+
global urlcount
10+
if not testurls:
11+
from ietf.tests import get_testurls
12+
testurls = [ tuple for tuple in get_testurls() if tuple[2] and "200" in tuple[0] ]
13+
urlcount = len(testurls)
14+
info = {}
15+
page = int(page)
16+
if not page in range(urlcount):
17+
page = 0
18+
info["next"] = (page + 1) % urlcount
19+
info["this"] = page
20+
info["prev"] = (page - 1 + urlcount) % urlcount
21+
info["new"] = "http://%s/%s" % (host, testurls[page][1][1:])
22+
info["old"] = testurls[page][2]
23+
return info
24+
25+
def review(request, page=0, panes=None):
26+
return render("utils/frame2.html", {"info": get_info(page) })
27+
28+
def top(request, page=None):
29+
return render("utils/review.html", {"info": get_info(page) })

0 commit comments

Comments
 (0)