Make !find and !info more robust
Add a new configuration variable 'tzUrl' for the location of a list of supported timezones Remove silly code that said "GMT" is not a valid timezone
This commit is contained in:
@ -88,6 +88,9 @@ class Apt:
|
||||
parser = FeedParser.FeedParser()
|
||||
parser.feed(p)
|
||||
p = parser.close()
|
||||
if type(p) == type(""):
|
||||
plugin.log.error("apt returned an error, do you have the deb-src URLs in %s.list" % distro)
|
||||
return "Package lookup faild"
|
||||
if apt.VersionCompare(maxp['Version'], p['Version']) < 0:
|
||||
maxp = p
|
||||
del parser
|
||||
|
@ -30,3 +30,5 @@ conf.registerChannelValue(conf.supybot.plugins.Webcal, 'doTopic',
|
||||
registry.Boolean(False,"""Whether to manage the topic"""))
|
||||
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'defaultChannel',
|
||||
registry.String('',"""Default channel to determine schedule for /msg replies"""))
|
||||
conf.registerGlobalValue(conf.supybot.plugins.Webcal, 'tzUrl',
|
||||
registry.String('', """URL to the list of timezones supported by the Webcal plugin"""))
|
||||
|
@ -165,8 +165,8 @@ class Webcal(callbacks.Plugin):
|
||||
if not url:
|
||||
return
|
||||
tzs = filter(lambda x: self._tzfilter(x.lower(),tz.lower()), pytz.all_timezones)
|
||||
if not tzs or 'gmt' in tz.lower():
|
||||
irc.error('Unknown timezone: %s - Full list: http://ubotu.ubuntu-nl.org/timezones.html' % tz)
|
||||
if not tzs:
|
||||
irc.error('Unknown timezone: %s - Full list: %s' % (tz, self.config.registryValue('tzUrl') or 'Value not set'))
|
||||
return
|
||||
newtopic = self.maketopic(c,tz=tzs[0])
|
||||
events = self.filter(self.cache[url], msg.args[0])
|
||||
@ -191,8 +191,8 @@ class Webcal(callbacks.Plugin):
|
||||
if not url:
|
||||
return
|
||||
tzs = filter(lambda x: self._tzfilter(x.lower(),tz.lower()), pytz.all_timezones)
|
||||
if not tzs or 'gmt' in tz.lower():
|
||||
irc.error('Unknown timezone: %s - Full list: http://ubotu.ubuntu-nl.org/timezones.html' % tz)
|
||||
if not tzs:
|
||||
irc.error('Unknown timezone: %s - Full list: %s' % (tz, self.config.registryValue('tzUrl') or 'Value not set'))
|
||||
return
|
||||
now = datetime.datetime.now(pytz.UTC)
|
||||
newtopic = self.maketopic(c,tz=tzs[0],num_events=1)
|
||||
|
Reference in New Issue
Block a user