Sweede is a fscking retard.

This commit is contained in:
Jeremy Fincher 2003-11-15 03:01:01 +00:00
parent 296af52ed9
commit 0e01a1dee8
2 changed files with 9 additions and 2 deletions

View File

@ -98,7 +98,13 @@ def canonicalName(command):
Currently, this makes everything lowercase and removes all dashes and Currently, this makes everything lowercase and removes all dashes and
underscores. underscores.
""" """
return command.translate(string.ascii, '\t -_').lower() assert not isinstance(command, unicode)
special = '\t -_'
reAppend = ''
while command and command[-1] in special:
reAppend = command[-1] + reAppend
command = command[:-1]
return command.translate(string.ascii, special).lower() + reAppend
def reply(msg, s, prefixName=True, private=False, notice=False): def reply(msg, s, prefixName=True, private=False, notice=False):
"""Makes a reply to msg with the payload s""" """Makes a reply to msg with the payload s"""

View File

@ -124,7 +124,8 @@ class FunctionsTestCase(unittest.TestCase):
self.assertEqual('foobar', callbacks.canonicalName('FOO-bar')) self.assertEqual('foobar', callbacks.canonicalName('FOO-bar'))
self.assertEqual('foobar', callbacks.canonicalName('FOOBAR')) self.assertEqual('foobar', callbacks.canonicalName('FOOBAR'))
self.assertEqual('foobar', callbacks.canonicalName('foo___bar')) self.assertEqual('foobar', callbacks.canonicalName('foo___bar'))
self.assertEqual('foobar', callbacks.canonicalName('_f_o_o-b_a_r_')) self.assertEqual('foobar', callbacks.canonicalName('_f_o_o-b_a_r'))
self.assertEqual('foobar--', callbacks.canonicalName('foobar--'))
def testAddressed(self): def testAddressed(self):
oldprefixchars = conf.prefixChars oldprefixchars = conf.prefixChars