def headline(s, level=2, bodyelement=None): if use_html: if bodyelement: return """<thead> <tr><th colspan="2" class="title" onclick="toggle('%(bodyelement)s', 'table-row-group', 'table-row-group')">%(title)s <span class="toggle-msg">(click to toggle)</span></th></tr> </thead>\n"""%{"bodyelement":bodyelement,"title":utils.html_escape(os.path.basename(s))} else: return "<h%d>%s</h%d>\n" % (level, utils.html_escape(s), level) else: return "---- %s ----\n" % (s)
def formatted_text(s, strip=False): if use_html: if strip: s = s.strip() return "<pre>%s</pre>" % (utils.html_escape(s)) else: return s
def table_row(source, version, arch, last_mod, maint, distribution, closes, fingerprint, sponsor, changedby): global row_number trclass = "sid" session = DBConn().session() for dist in distribution: if dist == "experimental": trclass = "exp" query = '''SELECT source FROM source_suite WHERE source = :source AND suite_name IN ('unstable', 'experimental')''' if not session.execute(query, {'source': source}).rowcount: trclass += " sourceNEW" session.commit() if row_number % 2 != 0: print("<tr class=\"%s even\">" % (trclass)) else: print("<tr class=\"%s odd\">" % (trclass)) if "sourceNEW" in trclass: print("<td class=\"package\">%s</td>" % (source)) else: print("<td class=\"package\"><a href=\"https://tracker.debian.org/pkg/%(source)s\">%(source)s</a></td>" % {'source': source}) print("<td class=\"version\">") for vers in version.split(): print("<a href=\"new/%s_%s.html\">%s</a><br/>" % (source, utils.html_escape(vers), utils.html_escape(vers))) print("</td>") print("<td class=\"arch\">%s</td>" % (arch)) print("<td class=\"distribution\">") for dist in distribution: print("%s<br/>" % (dist)) print("</td>") print("<td class=\"age\"><abbr title=\"%s\">%s</abbr></td>" % ( datetime.datetime.utcfromtimestamp(int(time.time()) - last_mod).strftime('%a, %d %b %Y %T UTC'), time_pp(last_mod), )) (name, mail) = maint.split(":", 1) print("<td class=\"upload-data\">") print("<span class=\"maintainer\">Maintainer: <a href=\"https://qa.debian.org/developer.php?login=%s\">%s</a></span><br/>" % (utils.html_escape(mail), utils.html_escape(name))) (name, mail) = changedby.split(":", 1) print("<span class=\"changed-by\">Changed-By: <a href=\"https://qa.debian.org/developer.php?login=%s\">%s</a></span><br/>" % (utils.html_escape(mail), utils.html_escape(name))) if sponsor: print("<span class=\"sponsor\">Sponsor: <a href=\"https://qa.debian.org/developer.php?login=%s\">%s</a>@debian.org</span><br/>" % (utils.html_escape(sponsor), utils.html_escape(sponsor))) print("<span class=\"signature\">Fingerprint: %s</span>" % (fingerprint)) print("</td>") print("<td class=\"closes\">") for close in closes: print("<a href=\"https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s\">#%s</a><br/>" % (utils.html_escape(close), utils.html_escape(close))) print("</td></tr>") row_number += 1
def table_row(source, version, arch, last_mod, maint, distribution, closes, fingerprint, sponsor, changedby): global row_number trclass = "sid" session = DBConn().session() for dist in distribution: if dist == "experimental": trclass = "exp" if not len(session.query(DBSource).filter_by(source = source).all()): trclass += " binNEW" session.commit() if row_number % 2 != 0: print "<tr class=\"%s even\">" % (trclass) else: print "<tr class=\"%s odd\">" % (trclass) if "binNEW" in trclass: print "<td class=\"package\">%s</td>" % (source) else: print "<td class=\"package\"><a href=\"http://packages.qa.debian.org/%(source)s\">%(source)s</a></td>" % {'source': source} print "<td class=\"version\">" for vers in version.split(): print "<a href=\"new/%s_%s.html\">%s</a><br/>" % (source, utils.html_escape(vers), utils.html_escape(vers)) print "</td>" print "<td class=\"arch\">%s</td>" % (arch) print "<td class=\"distribution\">" for dist in distribution: print "%s<br/>" % (dist) print "</td>" print "<td class=\"age\">%s</td>" % (last_mod) (name, mail) = maint.split(":", 1) print "<td class=\"upload-data\">" print "<span class=\"maintainer\">Maintainer: <a href=\"http://qa.debian.org/developer.php?login=%s\">%s</a></span><br/>" % (utils.html_escape(mail), utils.html_escape(name)) (name, mail) = changedby.split(":", 1) print "<span class=\"changed-by\">Changed-By: <a href=\"http://qa.debian.org/developer.php?login=%s\">%s</a></span><br/>" % (utils.html_escape(mail), utils.html_escape(name)) if sponsor: try: (login, domain) = sponsor.split("@", 1) print "<span class=\"sponsor\">Sponsor: <a href=\"http://qa.debian.org/developer.php?login=%s\">%s</a>@debian.org</span><br/>" % (utils.html_escape(login), utils.html_escape(login)) except Exception as e: pass print "<span class=\"signature\">Fingerprint: %s</span>" % (fingerprint) print "</td>" print "<td class=\"closes\">" for close in closes: print "<a href=\"http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s\">#%s</a><br/>" % (utils.html_escape(close), utils.html_escape(close)) print "</td></tr>" row_number+=1
def colour_output(s, colour): if use_html: return ("%s%s%s" % (html_colours[colour][0], utils.html_escape(s), html_colours[colour][1])) else: return ("%s%s%s" % (ansi_colours[colour], s, ansi_colours['end']))