From a788f3699c2fb8d9fad06d99e631a771c81e600e Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 3 Mar 2024 18:27:40 +0300 Subject: [PATCH 1/2] Fix(DB): Fix bug with adding same genre to book --- docs-ru/news.rst | 5 +++++ docs/news.rst | 5 +++++ m_librarian/inp.py | 7 +++++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs-ru/news.rst b/docs-ru/news.rst index a66ea93..fbdd698 100644 --- a/docs-ru/news.rst +++ b/docs-ru/news.rst @@ -1,6 +1,11 @@ Новости ======= +Версия 0.3.2 (2024-03-??) +------------------------- + +* Исправлена ошибка с повторным добавлением жанра книги. + Версия 0.3.1 (2024-02-25) ------------------------- diff --git a/docs/news.rst b/docs/news.rst index 4d1fe11..ce0b046 100644 --- a/docs/news.rst +++ b/docs/news.rst @@ -1,6 +1,11 @@ News ==== +Version 0.3.2 (2024-03-??) +-------------------------- + +* Fix a bug with adding the same genre to a book. + Version 0.3.1 (2024-02-25) -------------------------- diff --git a/m_librarian/inp.py b/m_librarian/inp.py index f910b10..6d3bd7d 100644 --- a/m_librarian/inp.py +++ b/m_librarian/inp.py @@ -2,7 +2,7 @@ import os from zipfile import ZipFile -from sqlobject import sqlhub +from sqlobject import dberrors, sqlhub from sqlobject.sqlbuilder import Select from .db import Author, Book, Extension, Genre, Language, \ @@ -71,7 +71,10 @@ def import_inp_line(archive, parts): for genre in genres.split(':'): if genre: genre_row = insert_name(Genre, genre, title=genre) - book.addGenre(genre_row) + try: + book.addGenre(genre_row) + except dberrors.DuplicateEntryError: + pass # The genre has already been added def tounicode(s): -- 2.39.2 From a084b00c33a20c15cf7737ad0b3578930bea69a8 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 28 Apr 2024 01:34:35 +0300 Subject: [PATCH 2/2] Docs: Update TODO [skip ci] --- TODO | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TODO b/TODO index f1fa2d7..ddfc80b 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,13 @@ Next release ------------ +List of authors, list of books - +do not select when clicking on column/row titles. + + +List of authors - sort by clicking on column titles. + + Installers. -- 2.39.2