mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-25 04:02:46 +01:00
Fixed the stupid DOM Element output, added test.
This commit is contained in:
parent
ed94dd44ca
commit
76ad28918f
@ -98,11 +98,14 @@ class Http(callbacks.Privmsg):
|
|||||||
if text.startswith('Error'):
|
if text.startswith('Error'):
|
||||||
raise FreshmeatException, text
|
raise FreshmeatException, text
|
||||||
dom = xml.dom.minidom.parseString(text)
|
dom = xml.dom.minidom.parseString(text)
|
||||||
project = dom.getElementsByTagName('projectname_full')[0]
|
def getNode(name):
|
||||||
version = dom.getElementsByTagName('latest_release_version')[0]
|
node = dom.getElementsByTagName(name)[0]
|
||||||
vitality = dom.getElementsByTagName('vitality_percent')[0]
|
return str(node.childNodes[0].data)
|
||||||
popularity = dom.getElementsByTagName('popularity_percent')[0]
|
project = getNode('projectname_full')
|
||||||
lastupdated = dom.getElementsByTagName('date_updated')[0]
|
version = getNode('latest_release_version')
|
||||||
|
vitality = getNode('vitality_percent')
|
||||||
|
popularity = getNode('popularity_percent')
|
||||||
|
lastupdated = getNode('date_updated')
|
||||||
irc.reply(msg,
|
irc.reply(msg,
|
||||||
'%s, last updated %s, with a vitality percent of %s '\
|
'%s, last updated %s, with a vitality percent of %s '\
|
||||||
'and a popularity of %s, is in version %s.' % \
|
'and a popularity of %s, is in version %s.' % \
|
||||||
|
Loading…
Reference in New Issue
Block a user