[Treepkg-commits] r450 - in trunk/contrib/sawmill/web: . templates
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Wed Sep 29 21:25:54 CEST 2010
Author: teichmann
Date: 2010-09-29 21:25:52 +0200 (Wed, 29 Sep 2010)
New Revision: 450
Modified:
trunk/contrib/sawmill/web/details.py
trunk/contrib/sawmill/web/templates/details.html
trunk/contrib/sawmill/web/templates/header.inc
Log:
sawmill: Prepared detail view for syndication:
Added anchors for each build and added render rel link if RSS file
exists next to treepkg.xml.
Modified: trunk/contrib/sawmill/web/details.py
===================================================================
--- trunk/contrib/sawmill/web/details.py 2010-09-26 08:53:16 UTC (rev 449)
+++ trunk/contrib/sawmill/web/details.py 2010-09-29 19:25:52 UTC (rev 450)
@@ -24,6 +24,8 @@
UNDER_SCORE = re.compile(r"_+(\w)")
+INVALID_LABEL = re.compile(r"[^a-zA-Z0-9_]")
+
def _create_time(s, format="%Y-%m-%d %H:%M:%S"):
return datetime.datetime(*(time.strptime(s, format)[0:6]))
@@ -31,6 +33,9 @@
log = log.replace(".txt", "").replace(".gz", "").capitalize()
return UNDER_SCORE.sub(lambda x: " %s" % x.group(1).upper(), log)
+def _make_valid_label(label):
+ return INVALID_LABEL.sub("_", label)
+
class TrackItem(object):
def __init__(self, treepkg, track, revision, status_file):
@@ -78,6 +83,15 @@
self.check_loaded()
return self.tags
+ def get_label(self):
+ self.check_loaded()
+ out = [
+ _make_valid_label(self.track),
+ _make_valid_label(self.revision) ]
+ if self.start:
+ out.append(self.start.strftime("%Y%m%d%H%M%S"))
+ return ''.join(out)
+
def log_path(self, log):
return "%s/tracks/%s/pkg/%s/log/%s" % (
self.treepkg, self.track, self.revision, log)
@@ -99,6 +113,7 @@
build_stop = property(get_build_stop)
build_logs = property(get_build_logs)
build_tags = property(get_tags)
+ build_label = property(get_label)
def __scan_track_items(treepkg, path):
@@ -139,28 +154,35 @@
def index(req, treepkg=''):
if not treepkg: util.redirect(req, "index.py")
- found = None
+ package_dir = None
for d in os.listdir(TREEPKG_DIR):
dp = os.path.join(TREEPKG_DIR, d)
if d == treepkg and os.path.isdir(dp):
- found = dp
+ package_dir = dp
break
- if not found:
+ if not package_dir:
req.status = apache.HTTP_NOT_FOUND
return "requested TreePkg not found"
- description, header = __description_header(found)
+ description, header = __description_header(package_dir)
- track_items = __scan_track_items(treepkg, found)
+ track_items = __scan_track_items(treepkg, package_dir)
- req.content_type = 'text/html;charset=utf-8'
- template = psp.PSP(req, filename='templates/details.html')
- template.run({
+ parameters = {
'page_title' : description,
'back_link' : 'index.py',
'base_dir' : BASE_DIR,
'description': description,
'header' : header,
'track_items': track_items
- })
+ }
+
+ if os.path.isfile(os.path.join(package_dir, "rss.xml")):
+ parameters['syndicate'] = (
+ 'Build error feed',
+ 'treepkgs/%s/rss.xml' % treepkg)
+
+ req.content_type = 'text/html;charset=utf-8'
+ template = psp.PSP(req, filename='templates/details.html')
+ template.run(parameters)
Modified: trunk/contrib/sawmill/web/templates/details.html
===================================================================
--- trunk/contrib/sawmill/web/templates/details.html 2010-09-26 08:53:16 UTC (rev 449)
+++ trunk/contrib/sawmill/web/templates/details.html 2010-09-29 19:25:52 UTC (rev 450)
@@ -86,21 +86,17 @@
curr_date = date_from_datetime(track_item.build_start)
if curr_date != last_date:
last_date = curr_date
-%>
-<tr class="date_row"><td colspan="7"><%= pretty_time(last_date, "%Y-%m-%d") %> (times in UTC)</td></tr>
-<%
+%><tr class="date_row"><td colspan="7"><%= pretty_time(last_date, "%Y-%m-%d") %> (times in UTC)</td></tr><%
# date changed
%>
<tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>">
-<td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td>
-<td style="font-weight:bold;"><%= nn(track_item.track) %></td>
+<td><a name=<%= quoteattr(track_item.build_label) %>><%= STATUS2MSG.get(track_item.build_status, 'error') %></a></td>
+<td><b><%= nn(track_item.track) %></b></td>
<td align="right"><%
tags = track_item.build_tags
if tags:
# a tag
-%>
-<a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a>
-<%
+%><a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a><%
else:
# not a tag
%><%= nn(track_item.revision) %><%
@@ -109,17 +105,13 @@
<td align="right"><%= pretty_time(track_item.build_start) %></td>
<td align="right"><%= pretty_time(track_item.build_stop) %></td>
<td align="right"><%= pretty_timedelta(track_item.stop, track_item.build_start) %></td>
-<td>
-<%
+<td><%
for log_desc, log_path in track_item.build_logs:
# for all logs
-%>
-[<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>]
+%>[<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>]
<%
# for all logs
-%></td>
-</tr>
-<%
+%></td></tr><%
# for all track itemes
%>
Modified: trunk/contrib/sawmill/web/templates/header.inc
===================================================================
--- trunk/contrib/sawmill/web/templates/header.inc 2010-09-26 08:53:16 UTC (rev 449)
+++ trunk/contrib/sawmill/web/templates/header.inc 2010-09-29 19:25:52 UTC (rev 450)
@@ -5,7 +5,13 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="icon" href="img/favicon.ico" type="image/x-icon">
- <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen">
+ <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen"><%
+if 'syndicate' in locals():
+ # generate syndication link
+%>
+ <link rel="alternate" type="application/rss+xml" title=<%= quoteattr(syndicate[0]) %> href=<%= quoteattr(syndicate[1])%>><%
+# no syndication
+%>
<title>Sägewerk - <%= escape(page_title) %></title>
</head>
<body>
More information about the Treepkg-commits
mailing list