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