text_buffer: Prevent using str as a datetime object

Cleanup a bit how `str_time` is assigned.

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2019-08-02 17:40:34 +02:00
parent d43c8cf878
commit d8774d8390
Signed by: pep
GPG key ID: DEDA74AEECA9D0F2

View file

@ -47,16 +47,12 @@ class Message:
txt[4:])
else:
me = False
str_time = time.strftime("%H:%M:%S")
if history:
txt = txt.replace(
'\x19o',
'\x19o\x19%s}' % dump_tuple(get_theme().COLOR_LOG_MSG))
str_time = time.strftime("%Y-%m-%d %H:%M:%S")
else:
if str_time is None:
str_time = time.strftime("%H:%M:%S")
else:
str_time = str_time.strftime("%Y-%m-%d %H:%M:%S")
self.txt = txt.replace('\t', ' ') + '\x19o'
self.nick_color = nick_color