From 0df768e24a8c254b8b1156a0a22ce75364d98553 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 16 Nov 2011 16:06:21 +0000 Subject: [PATCH] minor refactoring/optimization --- lib/parse/headers.py | 2 +- lib/parse/html.py | 10 ++-------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/parse/headers.py b/lib/parse/headers.py index 8430ea29b..07e58de42 100644 --- a/lib/parse/headers.py +++ b/lib/parse/headers.py @@ -39,7 +39,7 @@ def headersParser(headers): } for header in headers: - if header in topHeaders.keys(): + if header in topHeaders: value = headers[header] xmlfile = topHeaders[header] diff --git a/lib/parse/html.py b/lib/parse/html.py index 5cf43f98f..22ae7d82d 100644 --- a/lib/parse/html.py +++ b/lib/parse/html.py @@ -28,8 +28,6 @@ class htmlHandler(ContentHandler): self.__dbms = None self.__page = page - self.__regexp = None - self.__match = None self.dbms = None @@ -37,13 +35,9 @@ class htmlHandler(ContentHandler): if name == "dbms": self.__dbms = attrs.get("value") - if name == "error": - self.__regexp = attrs.get("regexp") - self.__match = re.search(self.__regexp, self.__page, re.I) - - if self.__match: + elif name == "error": + if re.search(attrs.get("regexp"), self.__page, re.I): self.dbms = self.__dbms - self.__match = None threadData = getCurrentThreadData() threadData.lastErrorPage = (threadData.lastRequestUID, self.__page)