mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-07 19:49:23 +01:00
Slight cleanup.
This commit is contained in:
parent
71ea32c811
commit
cc9522e833
@ -60,7 +60,7 @@ class WeatherUnit(registry.String):
|
|||||||
s = s.capitalize()
|
s = s.capitalize()
|
||||||
if s not in unitAbbrevs:
|
if s not in unitAbbrevs:
|
||||||
raise registry.InvalidRegistryValue,\
|
raise registry.InvalidRegistryValue,\
|
||||||
'Unit must be one of Fahrenheit, Celsius, or Kelvin.'
|
'Unit must be one of Fahrenheit, Celsius, or Kelvin.'
|
||||||
s = unitAbbrevs[s]
|
s = unitAbbrevs[s]
|
||||||
registry.String.setValue(self, s)
|
registry.String.setValue(self, s)
|
||||||
|
|
||||||
@ -69,12 +69,14 @@ class WeatherCommand(registry.String):
|
|||||||
m = Weather.weatherCommands
|
m = Weather.weatherCommands
|
||||||
if s not in m:
|
if s not in m:
|
||||||
raise registry.InvalidRegistryValue,\
|
raise registry.InvalidRegistryValue,\
|
||||||
'Command must be one of %s' % utils.commaAndify(m)
|
'Command must be one of %s' % utils.commaAndify(m)
|
||||||
else:
|
else:
|
||||||
method = getattr(Weather, s)
|
method = getattr(Weather, s)
|
||||||
Weather.weather.im_func.__doc__ = method.__doc__
|
Weather.weather.im_func.__doc__ = method.__doc__
|
||||||
registry.String.setValue(self, s)
|
registry.String.setValue(self, s)
|
||||||
|
|
||||||
|
# Registry variables moved to the bottom to use Weather.weatherCommands.
|
||||||
|
|
||||||
class Weather(callbacks.Privmsg):
|
class Weather(callbacks.Privmsg):
|
||||||
weatherCommands = ['ham', 'cnn']
|
weatherCommands = ['ham', 'cnn']
|
||||||
threaded = True
|
threaded = True
|
||||||
@ -326,7 +328,8 @@ conf.registerChannelValue(conf.supybot.plugins.Weather, 'temperatureUnit',
|
|||||||
reporting the weather."""))
|
reporting the weather."""))
|
||||||
conf.registerChannelValue(conf.supybot.plugins.Weather, 'command',
|
conf.registerChannelValue(conf.supybot.plugins.Weather, 'command',
|
||||||
WeatherCommand('cnn', """Sets the default command to use when retrieving
|
WeatherCommand('cnn', """Sets the default command to use when retrieving
|
||||||
the weather."""))
|
the weather. Command must be one of %s.""" %
|
||||||
|
utils.commaAndify(Weather.weatherCommands, And='or')))
|
||||||
|
|
||||||
Class = Weather
|
Class = Weather
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user