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
This commit is contained in:
Henrik Levkowetz 2007-06-18 14:34:00 +00:00
parent 7fa51e03cd
commit c03019afbe
5 changed files with 90 additions and 5 deletions

View file

@ -0,0 +1,21 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Comparison -- {{ info.old }} - {{ info.new }}</title>
</head>
<frameset rows="70, *">
<frame src="../top/{{ info.this }}">
<frameset cols="50%, 50%">
<frame name="old" src="{{ info.old }}">
<frame name="new" src="{{ info.new }}">
</frameset>
<noframes>
<p>this frameset document contains:
<ul>
<li><a href="{{ info.old }}">The old page</a><li>
<li><a href="{{ info.new }}">The new page</a><li>
</ul>
</noframes>
</frameset>
</html>

View file

@ -0,0 +1,23 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Comparison - {{ info.old }} / {{ info.new }}</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td align="left">
<a href="../../{{ info.prev }}" target="_top">&lt; Prev</a>
<br /><br />
<a href="{{ info.old }}" target="old">{{ info.old }}</a></td>
<td align="center"></td>
<td align="right">
<a href="../../{{ info.next }}" target="_top">Next &gt;</a>
<br /><br />
<a href="{{ info.new }}" target="new">{{ info.new }}</a></td>
</td>
</tr>
</table>
</body>
</html>

View file

@ -86,6 +86,15 @@ def read_testurls(filename):
file.close() file.close()
return tuples return tuples
def get_testurls():
testtuples = []
for root, dirs, files in os.walk(settings.BASE_DIR):
if "testurl.list" in files:
testtuples += read_testurls(root+"/testurl.list")
if "testurls.list" in files:
testtuples += read_testurls(root+"/testurls.list")
return testtuples
def filetext(filename): def filetext(filename):
file = open(filename) file = open(filename)
chunk = file.read() chunk = file.read()
@ -110,11 +119,7 @@ def module_setup(module):
module.testtuples = [] module.testtuples = []
module.testurls = [] module.testurls = []
module.diffchunks = [] module.diffchunks = []
for root, dirs, files in os.walk(settings.BASE_DIR): module.testtuples = get_testurls()
if "testurl.list" in files:
module.testtuples += read_testurls(root+"/testurl.list")
if "testurls.list" in files:
module.testtuples += read_testurls(root+"/testurls.list")
module.testurls = [ tuple[1] for tuple in module.testtuples ] module.testurls = [ tuple[1] for tuple in module.testtuples ]
# find diff chunks # find diff chunks

View file

@ -3,6 +3,7 @@ from django.conf.urls.defaults import patterns, include, handler404, handler500
from ietf.iesg.feeds import IESGMinutes from ietf.iesg.feeds import IESGMinutes
from ietf.idtracker.feeds import DocumentComments from ietf.idtracker.feeds import DocumentComments
from ietf.ipr.feeds import LatestIprDisclosures from ietf.ipr.feeds import LatestIprDisclosures
import ietf.utils.views
import ietf.views import ietf.views
feeds = { feeds = {
@ -30,4 +31,10 @@ urlpatterns = patterns('',
# Uncomment this for admin: # Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')), (r'^admin/', include('django.contrib.admin.urls')),
# Uncomment this for review pages:
(r'^review/$', 'ietf.utils.views.review'),
(r'^review/(?P<page>[0-9]+)/$', 'ietf.utils.views.review'),
(r'^review/top/(?P<page>[0-9]+)/$', 'ietf.utils.views.top'),
) )

29
ietf/utils/views.py Normal file
View file

@ -0,0 +1,29 @@
from django.shortcuts import render_to_response as render
testurls = []
urlcount = 0
host = "merlot.tools.ietf.org:31415"
def get_info(page):
global testurls
global urlcount
if not testurls:
from ietf.tests import get_testurls
testurls = [ tuple for tuple in get_testurls() if tuple[2] and "200" in tuple[0] ]
urlcount = len(testurls)
info = {}
page = int(page)
if not page in range(urlcount):
page = 0
info["next"] = (page + 1) % urlcount
info["this"] = page
info["prev"] = (page - 1 + urlcount) % urlcount
info["new"] = "http://%s/%s" % (host, testurls[page][1][1:])
info["old"] = testurls[page][2]
return info
def review(request, page=0, panes=None):
return render("utils/frame2.html", {"info": get_info(page) })
def top(request, page=None):
return render("utils/review.html", {"info": get_info(page) })