3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

classes: always raise an error if make_channel_ban creates something invalid

This commit is contained in:
James Lu 2018-10-20 12:31:54 -07:00
parent 31a65697a3
commit eb231a2aad

View File

@ -1412,7 +1412,8 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
template = string.Template(ban_style)
banhost = template.safe_substitute(self.users[uid].get_fields())
assert self.is_hostmask(banhost), "Ban mask %r is not a valid hostmask!" % banhost
if not self.is_hostmask(banhost):
raise ValueError("Ban mask %r is not a valid hostmask!" % banhost)
if ban_type in self.cmodes:
return ('+%s' % self.cmodes[ban_type], banhost)