Remove encode/decode wrappers
This is causing string/binary issues with Python 3. Everything seems happy with (Python3 unicode) strings, so remove these wrappers. Change-Id: I264c1bdae4acda671021bc7055ade099509fcbd1
This commit is contained in:
parent
79d7c6e5f3
commit
48ff9a79c2
@ -101,14 +101,6 @@ class Config(object):
|
||||
"Minutes: %(urlBasename)s.html\n"
|
||||
"Minutes (text): %(urlBasename)s.txt\n"
|
||||
"Log: %(urlBasename)s.log.html")
|
||||
# Input/output codecs.
|
||||
input_codec = 'utf-8'
|
||||
output_codec = 'utf-8'
|
||||
# Functions to do the i/o conversion.
|
||||
def enc(self, text):
|
||||
return text.encode(self.output_codec, 'replace')
|
||||
def dec(self, text):
|
||||
return text.decode(self.input_codec, 'replace')
|
||||
# Write out select logfiles
|
||||
update_realtime = True
|
||||
# CSS configs:
|
||||
@ -220,8 +212,6 @@ class Config(object):
|
||||
# If it doesn't, then it's assumed that the write took
|
||||
# care of writing (or publishing or emailing or wikifying)
|
||||
# it itself.
|
||||
if isinstance(text, str):
|
||||
text = self.enc(text)
|
||||
if isinstance(text, str):
|
||||
# Have a way to override saving, so no disk files are written.
|
||||
if getattr(self, "dontSave", False):
|
||||
@ -379,8 +369,7 @@ class MeetingCommands(object):
|
||||
if not chair: continue
|
||||
if chair not in self.chairs:
|
||||
if self._channelNicks is not None and \
|
||||
( chair.encode(self.config.input_codec)
|
||||
not in self._channelNicks()):
|
||||
( chair not in self._channelNicks()):
|
||||
self.reply("Warning: Nick not in channel: %s"%chair)
|
||||
self.addnick(chair, lines=0)
|
||||
self.chairs.setdefault(chair, True)
|
||||
@ -535,7 +524,6 @@ class MeetingCommands(object):
|
||||
commands = [ "#"+x[3:] for x in dir(self) if x[:3]=="do_" ]
|
||||
commands.sort()
|
||||
self.reply("Available commands: "+(" ".join(commands)))
|
||||
|
||||
|
||||
|
||||
class Meeting(MeetingCommands, object):
|
||||
@ -560,7 +548,7 @@ class Meeting(MeetingCommands, object):
|
||||
self.config = Config(self, writeRawLog=writeRawLog, safeMode=safeMode,
|
||||
extraConfig=extraConfig)
|
||||
if oldtopic:
|
||||
self.oldtopic = self.config.dec(oldtopic)
|
||||
self.oldtopic = oldtopic
|
||||
else:
|
||||
self.oldtopic = None
|
||||
self.lines = [ ]
|
||||
@ -583,15 +571,15 @@ class Meeting(MeetingCommands, object):
|
||||
def reply(self, x):
|
||||
"""Send a reply to the IRC channel."""
|
||||
if hasattr(self, '_sendReply') and not self._lurk:
|
||||
self._sendReply(self.config.enc(x))
|
||||
self._sendReply(x)
|
||||
else:
|
||||
print("REPLY:", self.config.enc(x))
|
||||
print("REPLY:", x)
|
||||
def topic(self, x):
|
||||
"""Set the topic in the IRC channel."""
|
||||
if hasattr(self, '_setTopic') and not self._lurk:
|
||||
self._setTopic(self.config.enc(x))
|
||||
self._setTopic(x)
|
||||
else:
|
||||
print("TOPIC:", self.config.enc(x))
|
||||
print("TOPIC:", x)
|
||||
def settopic(self):
|
||||
"The actual code to set the topic"
|
||||
if self._meetingTopic:
|
||||
@ -615,8 +603,6 @@ class Meeting(MeetingCommands, object):
|
||||
linenum = self.addrawline(nick, line, time_)
|
||||
|
||||
if time_ is None: time_ = time.localtime()
|
||||
nick = self.config.dec(nick)
|
||||
line = self.config.dec(line)
|
||||
|
||||
# Handle any commands given in the line.
|
||||
matchobj = self.config.command_RE.match(line)
|
||||
@ -637,8 +623,6 @@ class Meeting(MeetingCommands, object):
|
||||
def addrawline(self, nick, line, time_=None):
|
||||
"""This adds a line to the log, bypassing command execution.
|
||||
"""
|
||||
nick = self.config.dec(nick)
|
||||
line = self.config.dec(line)
|
||||
self.addnick(nick)
|
||||
line = line.strip(' \x01') # \x01 is present in ACTIONs
|
||||
# Setting a custom time is useful when replying logs,
|
||||
|
Loading…
Reference in New Issue
Block a user