From 5200ea585a806bcac5683ae24b2fcc2522e49720 Mon Sep 17 00:00:00 2001 From: Giebisch Date: Thu, 5 Jan 2023 23:37:43 +0100 Subject: [PATCH] Import Limit Bugfix and lint --- bookwyrm/importers/importer.py | 2 ++ bookwyrm/templates/settings/imports/imports.html | 4 ++-- bookwyrm/views/imports/import_data.py | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bookwyrm/importers/importer.py b/bookwyrm/importers/importer.py index 10bf453cd..a9fd37c63 100644 --- a/bookwyrm/importers/importer.py +++ b/bookwyrm/importers/importer.py @@ -34,6 +34,7 @@ class Importer: "reading": ["currently-reading", "reading", "currently reading"], } + # pylint: disable=too-many-locals def create_job(self, user, csv_file, include_reviews, privacy): """check over a csv and creates a database entry for the job""" csv_reader = csv.DictReader(csv_file, delimiter=self.delimiter) @@ -60,6 +61,7 @@ class Importer: import_jobs = ImportJob.objects.filter( user=user, created_date__gte=time_range ) + # pylint: disable=consider-using-generator imported_books = sum([job.successful_item_count for job in import_jobs]) allowed_imports = import_size_limit - imported_books if allowed_imports <= 0: diff --git a/bookwyrm/templates/settings/imports/imports.html b/bookwyrm/templates/settings/imports/imports.html index f498a619f..78dad3212 100644 --- a/bookwyrm/templates/settings/imports/imports.html +++ b/bookwyrm/templates/settings/imports/imports.html @@ -76,9 +76,9 @@
- + - + {% csrf_token %}
diff --git a/bookwyrm/views/imports/import_data.py b/bookwyrm/views/imports/import_data.py index dba995a7e..01812e1d5 100644 --- a/bookwyrm/views/imports/import_data.py +++ b/bookwyrm/views/imports/import_data.py @@ -58,6 +58,7 @@ class Import(View): import_jobs = models.ImportJob.objects.filter( user=request.user, created_date__gte=time_range ) + # pylint: disable=consider-using-generator imported_books = sum([job.successful_item_count for job in import_jobs]) data["import_size_limit"] = site_settings.import_size_limit data["import_limit_reset"] = site_settings.import_limit_reset