core & Filter & Owner: Fix Python 2.6 compatibibility.

This commit is contained in:
Valentin Lorentz 2013-01-05 20:51:36 +01:00
parent b7b60630d8
commit fdb7a764d4
3 changed files with 11 additions and 4 deletions

View File

@ -209,7 +209,7 @@ class Filter(callbacks.Plugin):
commonly used for text that simply needs to be hidden from inadvertent
reading by roaming eyes, since it's easily reversible.
"""
irc.reply(self._rot13_encoder(text.decode('utf8', errors='replace'))[0])
irc.reply(self._rot13_encoder(text.decode('utf8'))[0])
rot13 = wrap(rot13, ['text'])
@internationalizeDocstring

View File

@ -28,7 +28,14 @@
# POSSIBILITY OF SUCH DAMAGE.
###
from unittest import skip
import sys
if sys.version_info >= (2, 7, 0):
from unittest import skip
else:
# Workaround
def skip(string):
return lambda x:None
from supybot.test import *
import supybot.conf as conf

View File

@ -228,7 +228,7 @@ class PluginTestCase(SupyTestCase):
if not usePrefixChar and query[0] in prefixChars:
query = query[1:]
if sys.version_info[0] < 3:
query = query.encode('utf8', errors='replace') # unicode->str
query = query.encode('utf8') # unicode->str
msg = ircmsgs.privmsg(to, query, prefix=frm)
if self.myVerbose:
print 'Feeding: %r' % msg
@ -423,7 +423,7 @@ class ChannelPluginTestCase(PluginTestCase):
if query[0] not in prefixChars and usePrefixChar:
query = prefixChars[0] + query
if sys.version_info[0] < 3 and isinstance(query, unicode):
query = query.encode('utf8', errors='replace') # unicode->str
query = query.encode('utf8') # unicode->str
msg = ircmsgs.privmsg(to, query, prefix=frm)
if self.myVerbose:
print 'Feeding: %r' % msg