Coverage for src/ptf/context_processors.py: 100%
9 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-05 09:56 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-05 09:56 +0000
1from django.conf import settings
3from .models import Collection
6def ptf(request):
7 pid = settings.COLLECTION_PID
8 try:
9 collection = Collection.objects.get(pid=pid)
10 except Collection.DoesNotExist:
11 collection = ""
12 return {
13 "COLLECTION_PID": pid,
14 "SITE_DOMAIN": settings.SITE_DOMAIN,
15 "SITE_NAME": settings.SITE_NAME,
16 "VOLUME_STRING": settings.VOLUME_STRING,
17 "SHOW_DJVU": getattr(settings, "SHOW_DJVU", False),
18 "SHOW_BODY": getattr(settings, "SHOW_BODY", False),
19 "COLLECTION_TITLE": collection.title_tex
20 if collection
21 else settings.SITE_NAME.capitalize(),
22 "ISSN": collection.issn if collection else "",
23 "EISSN": collection.e_issn if collection else "",
24 "USE_FLEX": settings.USE_FLEX if hasattr(settings, "USE_FLEX") else True,
25 "ALLOW_TRANSLATION": settings.ALLOW_TRANSLATION
26 if hasattr(settings, "ALLOW_TRANSLATION")
27 else False,
28 "COMMENTS_VIEWS_ARTICLE_COMMENTS": getattr(
29 settings, "COMMENTS_VIEWS_ARTICLE_COMMENTS", False
30 ),
31 "COMMENTS_VIEWS_POLICY_LINK": getattr(settings, "COMMENTS_VIEWS_POLICY_LINK", ""),
32 }