From 35ed1dae004da9bc8b17c867735eb0b275d30d81 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 17 May 2018 07:58:00 +0300 Subject: [PATCH] Fix(inpx): Decode filenames to unicode --- docs-ru/news.rst | 5 +++++ docs/news.rst | 5 +++++ m_librarian/inp.py | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/docs-ru/news.rst b/docs-ru/news.rst index de42bd8..c4411e5 100644 --- a/docs-ru/news.rst +++ b/docs-ru/news.rst @@ -1,6 +1,11 @@ Новости ======= +Version 0.1.2 (2018-05-??) +-------------------------- + +* Исправлен импорт INPX: сделано декодирование имён файлов в юникод. + Version 0.1.1 (2018-05-17) -------------------------- diff --git a/docs/news.rst b/docs/news.rst index cab0fb4..b69ef56 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,11 @@ News ==== +Version 0.1.2 (2018-05-??) +-------------------------- + +* Fix inpx import: decode filenames to unicode. + Version 0.1.1 (2018-05-17) -------------------------- diff --git a/m_librarian/inp.py b/m_librarian/inp.py index 4b772af..f46bea6 100644 --- a/m_librarian/inp.py +++ b/m_librarian/inp.py @@ -78,7 +78,7 @@ def import_inp(archive, inp): connection = sqlhub.processConnection for file, in connection.queryAll(connection.sqlrepr( Select(Book.q.file, Book.q.archive == archive))): - files.add((archive, file)) + files.add((archive, file.decode('utf-8'))) for line in inp: line = line.decode('utf-8') _archive, parts = split_line(line) @@ -86,7 +86,7 @@ def import_inp(archive, inp): archives.add(_archive) for file, in connection.queryAll(connection.sqlrepr( Select(Book.q.file, Book.q.archive == _archive))): - files.add((_archive, file)) + files.add((_archive, file.decode('utf-8'))) file = parts[5] if (_archive or archive, file) not in files: files.add((_archive or archive, file)) -- 2.39.5