mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 03:02:52 +01:00
Update ValidChannel exceptions to contain the invalid channel.
This commit is contained in:
parent
99ea2e199e
commit
aea980ce41
@ -379,12 +379,11 @@ def main():
|
||||
try:
|
||||
network.channels.set(channels)
|
||||
break
|
||||
except registry.InvalidRegistryValue:
|
||||
# FIXME: say which ones weren't channels.
|
||||
output("""Not all of those are valid IRC channels. Be sure to
|
||||
prefix the channel with # (or +, or !, or &, but no one uses
|
||||
those channels, really). Be sure the channel key (if you are
|
||||
supplying one) does not contain a comma.""")
|
||||
except registry.InvalidRegistryValue, e:
|
||||
output("""%s is an invalid IRC channel. Be sure to prefix the
|
||||
channel with # (or +, or !, or &, but no one uses those
|
||||
channels, really). Be sure the channel key (if you are
|
||||
supplying one) does not contain a comma.""" % e.channel)
|
||||
else:
|
||||
network.channels.setValue([])
|
||||
|
||||
|
@ -161,6 +161,7 @@ class ValidNicksAllowingPercentS(ValidNicks):
|
||||
class ValidChannel(registry.String):
|
||||
"""Value must be a valid IRC channel name."""
|
||||
def setValue(self, v):
|
||||
self.channel = v
|
||||
if ',' in v:
|
||||
# To prevent stupid users from: a) trying to add a channel key
|
||||
# with a comma in it, b) trying to add channels separated by
|
||||
@ -176,6 +177,13 @@ class ValidChannel(registry.String):
|
||||
else:
|
||||
registry.String.setValue(self, v)
|
||||
|
||||
def error(self):
|
||||
try:
|
||||
super(ValidChannel, self).error()
|
||||
except registry.InvalidRegistryValue, e:
|
||||
e.channel = self.channel
|
||||
raise e
|
||||
|
||||
class ValidHostmask(registry.String):
|
||||
"""Value must be a valid user hostmask."""
|
||||
def setValue(self, v):
|
||||
|
Loading…
Reference in New Issue
Block a user