Added an assert to banmask.

This commit is contained in:
Jeremy Fincher 2003-10-02 04:47:33 +00:00
parent 32eb85e3c5
commit 898a4e2ef1

View File

@ -123,7 +123,6 @@ def isIP(s):
>>> isIP('abc.abc.abc.abc') >>> isIP('abc.abc.abc.abc')
0 0
""" """
if s.translate(string.ascii, _ipchars) == '': if s.translate(string.ascii, _ipchars) == '':
quads = s.split('.') quads = s.split('.')
if len(quads) <= 4: if len(quads) <= 4:
@ -145,6 +144,7 @@ def banmask(hostmask):
>>> banmask('nick!user@10.0.0.1') >>> banmask('nick!user@10.0.0.1')
'*!*@10.0.0.*' '*!*@10.0.0.*'
""" """
assert isUserHostmask(hostmask)
host = hostFromHostmask(hostmask) host = hostFromHostmask(hostmask)
if isIP(host): if isIP(host):
return ('*!*@%s.*' % host[:host.rfind('.')]) return ('*!*@%s.*' % host[:host.rfind('.')])