]> git.phdru.name Git - m_librarian.git/commitdiff
Fix(inpx): Fix decoding filenames to unicode
authorOleg Broytman <phd@phdru.name>
Mon, 4 Jun 2018 10:05:24 +0000 (13:05 +0300)
committerOleg Broytman <phd@phdru.name>
Mon, 4 Jun 2018 19:28:26 +0000 (22:28 +0300)
m_librarian/inp.py

index d0b567af4c5f97f218b4c393e575b6d69a18ab17..3789dd2e2d986c5969a7688d9651b8cfd2219095 100644 (file)
@@ -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