Savane support
Sanghyeon Seo
sanxiyn at gmail.com
Sat May 6 08:03:13 UTC 2006
Hi, I wrote a support for Savane. Attached.
Suggested entry for btslink.cfg:
[savannah]
type = savane
uri = http://savannah.gnu.org
uri-re = https?://savannah.gnu.org/bugs/(?:index.php|)\?func=detailitem&item_id=([0-9]+)
Tested with bugs from texmacs package.
Seo Sanghyeon
-------------- next part --------------
import urllib, urlparse, cgi
from BeautifulSoup import BeautifulSoup
from base import RemoteBts, failwith
def parse_uri(uri, key):
qs = urlparse.urlparse(uri)[4]
dic = cgi.parse_qs(qs)
return dic[key][0]
def parse_table(soup, key):
cell = soup.firstText(key).findParent('td')
value = cell.nextSibling.string
return value
def convert_text(text):
if text == 'None':
return None
return text.replace(' ', '-')
class SavaneData:
def __init__(self, uri):
self.id = parse_uri(uri, 'item_id')
soup = BeautifulSoup(urllib.urlopen(uri))
status = parse_table(soup, 'Open/Closed:')
resolution = parse_table(soup, 'Status:')
self.status = convert_text(status)
self.resolution = convert_text(resolution)
if self.resolution == 'Duplicate':
failwith("Savane: don't know how to follow duplicates")
class RemoteSavane(RemoteBts):
def __init__(self, cnf):
bugre = r'^%s/bugs/\?func=detailitem&item_id=([0-9]+)$'
urifmt = '%(uri)s/bugs/?func=detailitem&item_id=%(id)s'
RemoteBts.__init__(self, cnf, bugre, urifmt, SavaneData)
def isClosing(self, status, resolution):
return status == 'Closed' and resolution != 'Wont-Fix'
def isWontfix(self, status, resolution):
return resolution == 'Wont-Fix'
RemoteSavane.register('savane', RemoteSavane)
More information about the Bts-link-devel
mailing list