From: Oleg Broytman Date: Mon, 4 Jun 2018 10:05:24 +0000 (+0300) Subject: Fix(inpx): Fix decoding filenames to unicode X-Git-Tag: 0.1.4~16 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=2903febd2767ffd94f62f8e0b151e627e15b09d5;p=m_librarian.git Fix(inpx): Fix decoding filenames to unicode --- diff --git a/m_librarian/inp.py b/m_librarian/inp.py index d0b567a..3789dd2 100644 --- a/m_librarian/inp.py +++ b/m_librarian/inp.py @@ -1,6 +1,5 @@ import os -import sys from zipfile import ZipFile from sqlobject import sqlhub from sqlobject.sqlbuilder import Select @@ -73,11 +72,10 @@ def import_inp_line(archive, parts): book.addGenre(genre_row) -if sys.version[0] == 2: - def tounicode(s): +def tounicode(s): + if isinstance(s, bytes): return s.decode('utf-8') -else: - def tounicode(s): + else: return s