From a6c6cedd46157ef311556da3a1c412c65950c152 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Per=20=C3=98yvind=20Karlsen?= Date: Wed, 1 Jun 2016 14:56:46 +0200 Subject: add an additional check to verify username against html page of --- MgaRepo/log.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'MgaRepo') diff --git a/MgaRepo/log.py b/MgaRepo/log.py index 126e8c0..5c2a56d 100644 --- a/MgaRepo/log.py +++ b/MgaRepo/log.py @@ -565,6 +565,7 @@ from html.parser import HTMLParser class TagParser(HTMLParser): li = False ahref = False + userpage = None namepat = re.compile("(?P.*?)\s*\((?P.*?)\)") def handle_starttag(self, tag, attrs): @@ -574,17 +575,19 @@ class TagParser(HTMLParser): for att in attrs: if att[0] == "href": self.ahref = True + self.userpage = att[1] def handle_endtag(self, tag): if self.li and tag == "a": self.ahref = False + self.userpage = None if tag == "li": self.li = False def handle_data(self, data): if self.li and self.ahref: found = self.namepat.match(data) - if found and found.group("user") and found.group("name"): + if found and found.group("user") and found.group("name") and found.group("user")+".html" == self.userpage: usermap[found.group("user")] = "%s <%s@mageia.org>" % (found.group("name"), found.group("user")) def _map_user_names(): -- cgit v1.2.1