[Collab-qa-commits] r951 - udd/src/udd
neronus-guest at alioth.debian.org
neronus-guest at alioth.debian.org
Mon Jul 28 13:23:56 UTC 2008
Author: neronus-guest
Date: 2008-07-28 13:23:55 +0000 (Mon, 28 Jul 2008)
New Revision: 951
Modified:
udd/src/udd/popcon_gatherer.py
Log:
Add check for illegal characters and skip them
Modified: udd/src/udd/popcon_gatherer.py
===================================================================
--- udd/src/udd/popcon_gatherer.py 2008-07-28 12:41:58 UTC (rev 950)
+++ udd/src/udd/popcon_gatherer.py 2008-07-28 13:23:55 UTC (rev 951)
@@ -9,6 +9,7 @@
import sys
import gzip
from gatherer import gatherer
+import re
def get_gatherer(connection, config):
return popcon_gatherer(connection, config)
@@ -37,12 +38,20 @@
cur.execute("DELETE FROM popcon WHERE distribution = '%s'" % my_config['distribution'])
+ # used for ignoring ubuntu's broken popcon lines
+ ascii_match = re.compile("^[A-Za-z0-9-.+_]+$")
+
+ linenr = 0
for line in popcon.readlines():
+ linenr += 1
name, data = line.split(None, 1)
if name == "Submissions:":
cur.execute("INSERT INTO popcon (name, vote, distribution) VALUES ('_submissions', %s, '%s')" % (data, my_config['distribution']))
try:
(name, vote, old, recent, nofiles) = data.split()
+ if ascii_match.match(name) == None:
+ print name
+ continue
query = "EXECUTE pop_insert('%s', %s, %s, %s, %s)" %\
(name, vote, old, recent, nofiles)
cur.execute(query)
More information about the Collab-qa-commits
mailing list