From 6a943334c5e40a77a4ee782a471a74e006b032fb Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 6 May 2022 14:32:04 +0200 Subject: [PATCH] Marquise cover and some fixes. --- requirements/requirements.txt | 4 ++-- src/catalogue/fields.py | 7 +++++-- .../templates/catalogue/2022/book_detail.html | 2 +- src/experiments/base.py | 13 +++++++------ src/wolnelektury/templates/piwik/tracking_code.html | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 5b43762cc..97fc7917a 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,7 +1,7 @@ -i https://py.mdrn.pl/simple/ # django -Django==2.2.27 +Django==2.2.28 fnpdjango==0.4.5 docutils==0.16 @@ -44,7 +44,7 @@ mutagen==1.45.1 sorl-thumbnail==12.7.0 # home-brewed & dependencies -librarian==2.3.5 +librarian==2.4 # celery tasks celery[redis]==4.4.7 diff --git a/src/catalogue/fields.py b/src/catalogue/fields.py index 49fd46e2b..faff5c624 100644 --- a/src/catalogue/fields.py +++ b/src/catalogue/fields.py @@ -347,8 +347,11 @@ class BuildCover(BuildEbook): class BuildCoverClean(BuildCover): @classmethod def transform(cls, wldoc, fieldfile): - from librarian.cover import WLCover - return WLCover(wldoc.book_info, width=240).output_file() + if wldoc.book_info.cover_box_position == 'none': + from librarian.cover import WLCover + return WLCover(wldoc.book_info, width=240).output_file() + from librarian.covers.marquise import MarquiseCover + return MarquiseCover(wldoc.book_info, width=240).output_file() @BuildEbook.register('cover_thumb') diff --git a/src/catalogue/templates/catalogue/2022/book_detail.html b/src/catalogue/templates/catalogue/2022/book_detail.html index 9dfac9407..e0c82e0ee 100644 --- a/src/catalogue/templates/catalogue/2022/book_detail.html +++ b/src/catalogue/templates/catalogue/2022/book_detail.html @@ -344,7 +344,7 @@

Ta książka jest dostępna dla tysięcy dzieciaków dzięki darowiznom od osób takich jak Ty!

- Dorzuć się! + Dorzuć się!
Dorzuć się! diff --git a/src/experiments/base.py b/src/experiments/base.py index 3430df289..726f451cd 100644 --- a/src/experiments/base.py +++ b/src/experiments/base.py @@ -12,26 +12,27 @@ class Experiment: return True def __init__(self, request): - self.value = self.get_value(request) + self.value, self.manual = self.get_value(request) def override(self, value): self.value = value + self.manual = False def get_value(self, request): overrides = getattr(settings, 'EXPERIMENTS_OVERRIDES', {}) slug = self.slug if slug in overrides: - return overrides[slug] + return overrides[slug], False if self.qualify(request) is False: - return None + return None, False cookie_value = request.COOKIES.get(f'EXPERIMENT_{slug}') if cookie_value is not None: if cookie_value == 'on': - return True + return True, True elif cookie_value == 'off': - return False + return False, True number = int( hashlib.md5( @@ -39,4 +40,4 @@ class Experiment: ).hexdigest(), 16 ) % 10e6 / 10e6 - return number < self.size + return number < self.size, False diff --git a/src/wolnelektury/templates/piwik/tracking_code.html b/src/wolnelektury/templates/piwik/tracking_code.html index b70225eea..2dd3f1145 100644 --- a/src/wolnelektury/templates/piwik/tracking_code.html +++ b/src/wolnelektury/templates/piwik/tracking_code.html @@ -2,7 +2,7 @@