Don't use utils.str.chars anymore.

This commit is contained in:
Valentin Lorentz 2012-08-05 09:54:34 +02:00
parent 0c99a65afa
commit 4ffaff0638
3 changed files with 7 additions and 6 deletions

View File

@ -109,8 +109,9 @@ def canonicalCapability(capability):
assert isCapability(capability), 'got %s' % capability assert isCapability(capability), 'got %s' % capability
return capability.lower() return capability.lower()
_unwildcard_remover = utils.str.MultipleRemover('!@*?')
def unWildcardHostmask(hostmask): def unWildcardHostmask(hostmask):
return hostmask.translate(utils.str.chars, '!@*?') return _unwildcard_remover(hostmask)
_invert = invertCapability _invert = invertCapability
class CapabilitySet(set): class CapabilitySet(set):

View File

@ -602,8 +602,8 @@ def join(channel, key=None, prefix='', msg=None):
return IrcMsg(prefix=prefix, command='JOIN', args=(channel,), msg=msg) return IrcMsg(prefix=prefix, command='JOIN', args=(channel,), msg=msg)
else: else:
if conf.supybot.protocols.irc.strictRfc(): if conf.supybot.protocols.irc.strictRfc():
chars = utils.str.chars[128:] + '\x00\r\n\f\t\v ' chars = '\x00\r\n\f\t\v '
assert not any([x in chars for x in key]) assert not any([(ord(x) >= 128 or x in chars) for x in key])
return IrcMsg(prefix=prefix, command='JOIN', return IrcMsg(prefix=prefix, command='JOIN',
args=(channel, key), msg=msg) args=(channel, key), msg=msg)
@ -622,9 +622,9 @@ def joins(channels, keys=None, prefix='', msg=None):
args=(','.join(channels),), msg=msg) args=(','.join(channels),), msg=msg)
else: else:
if conf.supybot.protocols.irc.strictRfc(): if conf.supybot.protocols.irc.strictRfc():
chars = utils.str.chars[128:] + '\x00\r\n\f\t\v ' chars = '\x00\r\n\f\t\v '
for key in keys: for key in keys:
assert not any([x in chars for x in key]) assert not any([(ord(x) >= 128 or x in chars) for x in key])
return IrcMsg(prefix=prefix, return IrcMsg(prefix=prefix,
command='JOIN', command='JOIN',
args=(','.join(channels), ','.join(keys)), msg=msg) args=(','.join(channels), ','.join(keys)), msg=msg)

View File

@ -473,7 +473,7 @@ class String(Value):
_printable = string.printable[:-4] _printable = string.printable[:-4]
def _needsQuoting(self, s): def _needsQuoting(self, s):
return s.translate(utils.str.chars, self._printable) and s.strip() != s return any([x not in self._printable for x in s]) and s.strip() != s
def __str__(self): def __str__(self):
s = self.value s = self.value