From eb231a2aad42053bf89fdc3c39b54b0cfc400935 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sat, 20 Oct 2018 12:31:54 -0700 Subject: [PATCH] classes: always raise an error if make_channel_ban creates something invalid --- classes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes.py b/classes.py index 1efa48d..342a9dd 100644 --- a/classes.py +++ b/classes.py @@ -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)