paranoid cosmetics

This commit is contained in:
Bernardo Damele 2010-11-24 12:03:01 +00:00
parent b2b521fc8a
commit 253eafb643
2 changed files with 2 additions and 0 deletions

View File

@ -1541,6 +1541,7 @@ def extractErrorMessage(page):
if isinstance(page, basestring): if isinstance(page, basestring):
for regex in (r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s+(?P<result>.+?)<br\s*/?\s*>", r"<li>Error Type:<br>(?P<result>.+?)</li>"): for regex in (r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s+(?P<result>.+?)<br\s*/?\s*>", r"<li>Error Type:<br>(?P<result>.+?)</li>"):
match = re.search(regex, page, re.DOTALL | re.IGNORECASE) match = re.search(regex, page, re.DOTALL | re.IGNORECASE)
if match: if match:
retVal = htmlunescape(match.group("result")).replace("<br>", "\n").strip() retVal = htmlunescape(match.group("result")).replace("<br>", "\n").strip()
break break

View File

@ -310,6 +310,7 @@ class Connect:
if conf.parseErrors: if conf.parseErrors:
msg = extractErrorMessage(page) msg = extractErrorMessage(page)
if msg: if msg:
logger.info("parsed error message: '%s'" % msg) logger.info("parsed error message: '%s'" % msg)