Finally fix bug #1034916, Weather.wunder exception

This commit is contained in:
James Vega 2004-10-23 16:05:22 +00:00
parent 06c16396b0
commit 168e61aef8

View File

@ -444,13 +444,22 @@ class Weather(callbacks.Privmsg):
resp.append('Conditions: %s.' % info['Conditions'])
humidity = info['Humidity']
resp.append('Humidity: %s.' % info['Humidity'])
(dew, deg, unit) = info['Dew Point'].split()
if convert:
dew = self._getTemp(int(dew), deg, unit, msg.args[0])
else:
dew = deg.join((dew, unit))
resp.append('Dew Point: %s.' % dew)
resp.append('Wind: %s at %s %s.' % tuple(info['Wind'].split()))
# Apparently, the "Dew Point" and "Wind" categories are occasionally
# set to "-" instead of an actual reading. So, we'll just catch
# the ValueError from trying to unpack a tuple of the wrong size.
try:
(dew, deg, unit) = info['Dew Point'].split()
if convert:
dew = self._getTemp(int(dew), deg, unit, msg.args[0])
else:
dew = deg.join((dew, unit))
resp.append('Dew Point: %s.' % dew)
except ValueError:
pass
try:
resp.append('Wind: %s at %s %s.' % tuple(info['Wind'].split()))
except ValueError:
pass
resp.append('Pressure: %s.' % info['Pressure'])
resp.append('Visibility: %s.' % info['Visibility'])
resp = map(utils.htmlToText, resp)