mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-30 14:14:37 +01:00
Added some more error-checking to the addAlias method.
This commit is contained in:
parent
28fb603ca0
commit
e0184c5422
@ -189,6 +189,8 @@ class Alias(callbacks.Privmsg):
|
||||
def addAlias(self, irc, name, alias, freeze=False):
|
||||
if self._invalidCharsRe.search(name):
|
||||
raise AliasError, 'Names cannot contain spaces or square brackets.'
|
||||
if conf.enablePipeSyntax and '|' in name:
|
||||
raise AliasError, 'Names cannot contain pipes.'
|
||||
realName = callbacks.canonicalName(name)
|
||||
if name != realName:
|
||||
raise AliasError,'That name isn\'t valid. Try %r instead'%realName
|
||||
|
@ -98,6 +98,13 @@ class AliasTestCase(PluginTestCase, PluginDocumentation):
|
||||
self.assertError('alias FOO foo')
|
||||
self.assertError('alias [] foo')
|
||||
self.assertError('alias "foo bar" foo')
|
||||
try:
|
||||
conf.enablePipeSyntax = True
|
||||
self.assertError('alias "foo|bar" foo')
|
||||
conf.enablePipeSyntax = False
|
||||
self.assertNotError('alias "foo|bar" foo')
|
||||
finally:
|
||||
conf.enablePipeSyntax = False
|
||||
|
||||
def testNotCannotNestRaised(self):
|
||||
self.assertNotError('alias mytell "tell $channel $1"')
|
||||
|
Loading…
Reference in New Issue
Block a user