From d30005d5b6a7d1b0b89601e3517c1cb41ab3786e Mon Sep 17 00:00:00 2001 From: Tris Forster Date: Sun, 24 May 2026 11:48:42 +1000 Subject: [PATCH 1/2] Indexing bug fix --- polyphonic/library/views/__init__.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/polyphonic/library/views/__init__.py b/polyphonic/library/views/__init__.py index d621484..6feb07a 100644 --- a/polyphonic/library/views/__init__.py +++ b/polyphonic/library/views/__init__.py @@ -23,7 +23,7 @@ from polyphonic.library.models import Collection, Work, Document, Section from polyphonic.library.music_tags import MUSIC_TAGS, MusicTag from polyphonic.library import forms, models from polyphonic.library.pdf_utils import extract_pages, extract_and_concat -from polyphonic.library.indexer import indexer, model_search +from polyphonic.library.indexer import index_works, model_search import logging @@ -304,8 +304,7 @@ class WorkAddView(CollectionMixin, FormView): for f in uploads: docs.append(work.docs.create(upload=f).pk) - ix = indexer.get_index() - indexer.index_works(ix, [work]) + index_works([work]) if len(docs) == 1: return redirect("document_annotate", docs[0]) @@ -319,7 +318,7 @@ class WorkDetailView(CollectionMixin, DetailView): def get_context_data(self, *args, **kwargs): context = super().get_context_data(*args, **kwargs) - methods = set("upload") + methods = set(["upload"]) match self.collection.storage.storage: case "library.storage.GDriveLinkStorage": methods.discard("upload") From b217fbea5ef745c28e3a5bf129c30bd1d415a9e9 Mon Sep 17 00:00:00 2001 From: Tris Forster Date: Sun, 24 May 2026 14:23:59 +1000 Subject: [PATCH 2/2] Sorted out linting --- pyproject.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index f35e799..5d1ca71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,12 +26,22 @@ dependencies = [ django-debug-toolbar = "5.2" ruff = "^0.15.12" coverage = "^7.14.0" +django-types = "^0.24.0" [tool.poetry.scripts] poly-tool = "polyphonic.manage:main" [tool.ruff] extend-exclude = ["**/migrations/"] +extend-select = [ + "DJ", # flake8-django: Django-specific bugs + "E", # pycodestyle errors + "F", # Pyflakes + "W", # pycodestyle warnings + "I", # isort + "UP", # pyupgrade + "B", # flake8-bugbear +] [build-system] requires = ["poetry-core>=2.0.0,<3.0.0"]