Bugtracker: Make handling of Trac more strict.

This commit is contained in:
Krytarik Raido
2018-07-15 01:04:04 +02:00
parent d72081d106
commit 0bbbf8b700
2 changed files with 20 additions and 16 deletions

View File

@ -24,7 +24,7 @@ import supybot.world as world
from imp import reload from imp import reload
__version__ = "3.3.0" __version__ = "3.4.0"
__author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com") __author__ = supybot.Author("Krytarik Raido", "krytarik", "krytarik@tuxgarage.com")
__contributors__ = { __contributors__ = {
supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'], supybot.Author("Dennis Kaarsemaker", "Seveas", "dennis@kaarsemaker.net"): ['Original Author'],

View File

@ -1002,25 +1002,29 @@ class Trac(IBugtracker):
if 'HTTP Error 500' in str(e): if 'HTTP Error 500' in str(e):
raise BugNotFoundError raise BugNotFoundError
raise BugtrackerError(self.errget % (self.description, e, url)) raise BugtrackerError(self.errget % (self.description, e, url))
raw = raw.replace('\r\n', '\n') try:
(headers, rest) = raw.split('\n', 1) raw = raw.replace('\r\n', '\n')
headers = headers.strip().split('\t') (headers, rest) = raw.split('\n', 1)
rest = rest.strip().split('\t') headers = headers.strip().split('\t')
rest = rest.strip().split('\t')
title = status = package = severity = assignee = ""
if "summary" in headers:
title = rest[headers.index("summary")] title = rest[headers.index("summary")]
if "status" in headers:
status = rest[headers.index("status")] status = rest[headers.index("status")]
if "component" in headers:
package = rest[headers.index("component")] package = rest[headers.index("component")]
if "severity" in headers: severity = assignee = ""
severity = rest[headers.index("severity")] if "severity" in headers:
elif "priority" in headers: severity = rest[headers.index("severity")]
severity = rest[headers.index("priority")] elif "priority" in headers:
if "owner" in headers: severity = rest[headers.index("priority")]
assignee = rest[headers.index("owner")] if "owner" in headers:
return (id, package, title, severity, status, assignee, url, [], []) assignee = rest[headers.index("owner")]
return (id, package, title, severity, status, assignee, url, [], [])
except Exception as e:
# Due to unreliable matching
if '.' in self.name:
supylog.exception(self.errparse % (self.description, e, url))
return
raise BugtrackerError(self.errparse % (self.description, e, url))
# Introspection is quite cool # Introspection is quite cool
defined_bugtrackers = {} defined_bugtrackers = {}