From d8774d83907a031664b4956b45c2cbe8e6589d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Fri, 2 Aug 2019 17:40:34 +0200 Subject: [PATCH] text_buffer: Prevent using str as a datetime object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleanup a bit how `str_time` is assigned. Signed-off-by: Maxime “pep” Buquet --- poezio/text_buffer.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/poezio/text_buffer.py b/poezio/text_buffer.py index f942c48e..bf0ac966 100644 --- a/poezio/text_buffer.py +++ b/poezio/text_buffer.py @@ -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