[Piuparts-commits] [piuparts] 18/20: p-r: fix id= attributes by replacing '+' with '_'

Holger Levsen holger at moszumanska.debian.org
Sat Nov 23 20:23:35 UTC 2013


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit 515ef8572d29e331c4dcd9d7943f128f98bc8082
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Nov 17 14:53:40 2013 +0100

    p-r: fix id= attributes by replacing '+' with '_'
    
    '+' is valid in package names but not in id attributes
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piuparts-report.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/piuparts-report.py b/piuparts-report.py
index c1abf07..57624cb 100644
--- a/piuparts-report.py
+++ b/piuparts-report.py
@@ -647,6 +647,11 @@ def get_email_address(maintainer):
     return email
 
 
+def package2id(package_name):
+    # "+" is not a valid identifier char for id=... attributes
+    return package_name.replace("+", "_")
+
+
 # return order preserving list of the first occurrence of an element
 def unique(stuff):
     # can't use set() because 'stuff' is a list of lists and list() is not hashable
@@ -1051,7 +1056,7 @@ class Section:
 
             sourcerows =    "<tr class=\"titlerow\">" \
                           + "<td class=\"titlecell\" colspan=\"6\" id=\"%s\">%s in %s</td>" \
-                            % (source, source, self._config.section) \
+                            % (package2id(source), source, self._config.section) \
                           + "</tr>\n"
 
             sourcerows +=   "<tr class=\"normalrow\">" \
@@ -1310,7 +1315,7 @@ class Section:
 
             for package in packages:
                 vlist += "<li id=\"%s\">%s" % (
-                                         package["Package"],
+                                         package2id(package["Package"]),
                                          self.link_to_source_summary(package["Package"]))
                 if with_counts:
                     vlist += " (%d, %d)" % (self._binary_db.rrdep_count(package), \

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list