From 70880645deaf4929456d51fd8bbeba07f324b040 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Tue, 20 Sep 2022 15:12:39 +0200 Subject: [PATCH] Upgrades --- requirements/requirements.txt | 34 ++++++++++++++--------------- src/catalogue/fields.py | 24 ++++++++++---------- src/catalogue/tasks.py | 10 ++++----- src/club/civicrm.py | 4 ++-- src/dictionary/models.py | 4 ++-- src/picture/tasks.py | 6 ++--- src/stats/tasks.py | 4 ++-- src/wolnelektury/settings/static.py | 3 +-- 8 files changed, 44 insertions(+), 45 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 482af4531..8d597034e 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -2,22 +2,22 @@ # django Django==2.2.28 -fnpdjango==0.4.5 +fnpdjango==0.6 docutils==0.16 -django-pipeline==2.0.5 -libsasscompiler==0.1.8 -jsmin==2.2.2 +django-pipeline==2.0.8 +libsasscompiler==0.1.9 +jsmin==3.0.1 -fnp-django-pagination==2.2.3 -django-modeltranslation==0.16.2 -django-allauth==0.44 +fnp-django-pagination==2.2.5 +django-modeltranslation==0.18.2 +django-allauth==0.51 django-extensions==3.1.1 -djangorestframework==3.12.4 -djangorestframework-xml -django-admin-ordering==0.10.0 -django-machina==1.0.2 -django-countries==7.2.1 +djangorestframework==3.13.1 +djangorestframework-xml==2.0.0 +django-admin-ordering==0.14.0 +django-machina==1.1.6 +django-countries==7.3.2 # A version compatible with Django 2.2, with long help text and editable max_length. -e git+https://github.com/rczajka/django-forms-builder@8ec4022f2a185658b4b23c3d020e0d5c3cb88774#egg=django-forms-builder @@ -30,16 +30,16 @@ pyyaml==5.4.1 polib==1.1.1 -pytz==2021.1 +pytz==2022.2.1 -django-honeypot==0.9.0 +django-honeypot==1.0.2 python-memcached==1.59 python-fb==0.2 -Feedparser==6.0.2 +Feedparser==6.0.10 -Pillow==8.4.0 +Pillow==9.2.0 mutagen==1.45.1 sorl-thumbnail==12.7.0 @@ -52,7 +52,7 @@ celery[redis]==4.4.7 # OAI-PMH pyoai==2.5.0 -scorched==0.12 +scorched==0.13 django-getpaid==1.8.0 deprecated diff --git a/src/catalogue/fields.py b/src/catalogue/fields.py index faff5c624..e177cd571 100644 --- a/src/catalogue/fields.py +++ b/src/catalogue/fields.py @@ -10,7 +10,7 @@ from django.db.models.fields.files import FieldFile from catalogue import app_settings from catalogue.constants import LANGUAGES_3TO2, EBOOK_FORMATS_WITH_CHILDREN, EBOOK_FORMATS_WITHOUT_CHILDREN from catalogue.utils import absolute_url, remove_zip, truncate_html_words, gallery_path, gallery_url -from celery.task import Task, task +from celery import Task, shared_task from celery.utils.log import get_task_logger from waiter.utils import clear_cache @@ -178,11 +178,11 @@ class BuildEbook(Task): if fieldfile.field.format_name in app_settings.FORMAT_ZIPS: remove_zip(app_settings.FORMAT_ZIPS[fieldfile.field.format_name]) # Don't decorate BuildEbook, because we want to subclass it. -BuildEbookTask = task(BuildEbook, ignore_result=True) +BuildEbookTask = shared_task(BuildEbook, ignore_result=True) @BuildEbook.register('txt') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildTxt(BuildEbook): @staticmethod def transform(wldoc, fieldfile): @@ -190,7 +190,7 @@ class BuildTxt(BuildEbook): @BuildEbook.register('pdf') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildPdf(BuildEbook): @staticmethod def transform(wldoc, fieldfile): @@ -204,7 +204,7 @@ class BuildPdf(BuildEbook): @BuildEbook.register('epub') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildEpub(BuildEbook): librarian2_api = True @@ -218,7 +218,7 @@ class BuildEpub(BuildEbook): @BuildEbook.register('mobi') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildMobi(BuildEbook): librarian2_api = True @@ -232,7 +232,7 @@ class BuildMobi(BuildEbook): @BuildEbook.register('html') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildHtml(BuildEbook): def build(self, fieldfile): from django.core.files.base import ContentFile @@ -343,7 +343,7 @@ class BuildCover(BuildEbook): @BuildEbook.register('cover_clean') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildCoverClean(BuildCover): @classmethod def transform(cls, wldoc, fieldfile): @@ -355,7 +355,7 @@ class BuildCoverClean(BuildCover): @BuildEbook.register('cover_thumb') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildCoverThumb(BuildCover): @classmethod def transform(cls, wldoc, fieldfile): @@ -364,7 +364,7 @@ class BuildCoverThumb(BuildCover): @BuildEbook.register('cover_api_thumb') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildCoverApiThumb(BuildCover): @classmethod def transform(cls, wldoc, fieldfile): @@ -373,7 +373,7 @@ class BuildCoverApiThumb(BuildCover): @BuildEbook.register('simple_cover') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildSimpleCover(BuildCover): @classmethod def transform(cls, wldoc, fieldfile): @@ -382,7 +382,7 @@ class BuildSimpleCover(BuildCover): @BuildEbook.register('cover_ebookpoint') -@task(ignore_result=True) +@shared_task(ignore_result=True) class BuildCoverEbookpoint(BuildCover): @classmethod def transform(cls, wldoc, fieldfile): diff --git a/src/catalogue/tasks.py b/src/catalogue/tasks.py index f2ee55f38..b703e171f 100644 --- a/src/catalogue/tasks.py +++ b/src/catalogue/tasks.py @@ -2,7 +2,7 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from traceback import print_exc -from celery.task import task +from celery import shared_task from celery.utils.log import get_task_logger from django.conf import settings from django.utils import timezone @@ -22,7 +22,7 @@ def touch_tag(tag): type(tag).objects.filter(pk=tag.pk).update(**update_dict) -@task +@shared_task def index_book(book_id, book_info=None, **kwargs): from catalogue.models import Book try: @@ -33,7 +33,7 @@ def index_book(book_id, book_info=None, **kwargs): raise e -@task(ignore_result=True, rate_limit=settings.CATALOGUE_CUSTOMPDF_RATE_LIMIT) +@shared_task(ignore_result=True, rate_limit=settings.CATALOGUE_CUSTOMPDF_RATE_LIMIT) def build_custom_pdf(book_id, customizations, file_name, waiter_id=None): """Builds a custom PDF file.""" try: @@ -61,13 +61,13 @@ def build_custom_pdf(book_id, customizations, file_name, waiter_id=None): WaitedFile.objects.filter(pk=waiter_id).delete() -@task(ignore_result=True) +@shared_task(ignore_result=True) def update_counters(): from .helpers import update_counters update_counters() -@task(ignore_result=True) +@shared_task(ignore_result=True) def update_references(book_id): from catalogue.models import Book Book.objects.get(id=book_id).update_references() diff --git a/src/club/civicrm.py b/src/club/civicrm.py index ac3de7039..b770fbd0f 100644 --- a/src/club/civicrm.py +++ b/src/club/civicrm.py @@ -1,6 +1,6 @@ from datetime import datetime import json -from celery.task import task +from celery import shared_task from django.conf import settings import requests import yaml @@ -171,7 +171,7 @@ civicrm = CiviCRM( settings.CIVICRM_KEY, ) -@task(ignore_result=True) +@shared_task(ignore_result=True) def report_activity(*args, **kwargs): civicrm.report_activity(*args, **kwargs) diff --git a/src/dictionary/models.py b/src/dictionary/models.py index d395b231f..cadee0d13 100644 --- a/src/dictionary/models.py +++ b/src/dictionary/models.py @@ -2,7 +2,7 @@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # from django.db import models, transaction -from celery.task import task +from celery import shared_task from sortify import sortify from celery.utils.log import get_task_logger @@ -44,7 +44,7 @@ class NoteSource(models.Model): ordering = ['book'] -@task(ignore_result=True) +@shared_task(ignore_result=True) def build_notes(book): if not book.findable: return diff --git a/src/picture/tasks.py b/src/picture/tasks.py index e815f190c..ff9aa1357 100644 --- a/src/picture/tasks.py +++ b/src/picture/tasks.py @@ -4,12 +4,12 @@ import json from traceback import print_exc -from celery.task import task +from celery import shared_task from django.core.files.base import ContentFile from django.template.loader import render_to_string -@task +@shared_task def generate_picture_html(picture_id): import picture.models pic = picture.models.Picture.objects.get(pk=picture_id) @@ -22,7 +22,7 @@ def generate_picture_html(picture_id): pic.html_file.save("%s.html" % pic.slug, ContentFile(html_text)) -@task +@shared_task def index_picture(picture_id, picture_info=None, **kwargs): from picture.models import Picture try: diff --git a/src/stats/tasks.py b/src/stats/tasks.py index 21f2470cc..b62f3e9c2 100644 --- a/src/stats/tasks.py +++ b/src/stats/tasks.py @@ -1,7 +1,7 @@ # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # -from celery.task import task +from celery import shared_task from django.conf import settings import logging from urllib.parse import urlsplit @@ -21,6 +21,6 @@ except AttributeError: _host = None -@task(ignore_result=True) +@shared_task(ignore_result=True) def track_request(piwik_args): urlopen("%s%s%s" % (settings.PIWIK_URL, "piwik.php?", piwik_args)) diff --git a/src/wolnelektury/settings/static.py b/src/wolnelektury/settings/static.py index a1e53186d..66caafbe3 100644 --- a/src/wolnelektury/settings/static.py +++ b/src/wolnelektury/settings/static.py @@ -226,8 +226,7 @@ PIPELINE = { ) } -STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineCachedStorage' -#STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' +STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineManifestStorage' # PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss' # PIPELINE_PYSCSS_ARGUMENTS = '' -- 2.20.1