]> piware.de Git - bin.git/blobdiff - workitems.py
workitems: fix bp links if they are already URLs
[bin.git] / workitems.py
index 7b3ebef577b2319564588f455c2f4e2108bfd994..5cad66dea718fc9f82ac776b318de6a7ed2209eb 100755 (executable)
@@ -143,7 +143,7 @@ def get_blueprint_status(blueprint_url):
 
     found_status = False
     result = []
-    for l in urllib.urlopen(blueprint_url + '?'):
+    for l in urllib.urlopen(blueprint_url):
         end = False
         if not found_status:
             if status_re.search(l):
@@ -315,6 +315,8 @@ def csv(db, from_date, to_date):
     data = workitems_over_time(db)
 
     dates = sorted(data.keys())
+    if not dates:
+        return
 
     f = _fromstr(from_date or dates[0])
     t = _fromstr(to_date or dates[-1])
@@ -367,8 +369,12 @@ def html(db):
     completion.sort(key=lambda k: k[1], reverse=True)
 
     for (bp, percent) in completion:
-        print '  <tr><td><a href="%s/ubuntu/+spec/%s">%s</a></td> <td>%i/%i/%i</td> <td>%i%%</td> <td>%s</td></tr>' % (
-                blueprints_base_url, bp, bp, data[bp][0], data[bp][2],
+        if bp.startswith('http:'):
+            url = bp
+        else:
+            url = '%s/ubuntu/+spec/%s' % (blueprints_base_url, bp)
+        print '  <tr><td><a href="%s">%s</a></td> <td>%i/%i/%i</td> <td>%i%%</td> <td>%s</td></tr>' % (
+                url, bp, data[bp][0], data[bp][2],
                 data[bp][1], percent,
                 data[bp][-1])