From c6da204a282615c4662157ecc7f79e0ac6c716cb Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Sat, 1 Feb 2020 21:20:43 +0100
Subject: [PATCH] Move crawling code for licence information from settings.py
 to corresponding view

---
 aleksis/core/settings.py | 13 -------------
 aleksis/core/views.py    | 18 ++++++++++++++++--
 2 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/aleksis/core/settings.py b/aleksis/core/settings.py
index 4ff8688f4..a1371369b 100644
--- a/aleksis/core/settings.py
+++ b/aleksis/core/settings.py
@@ -480,16 +480,3 @@ CKEDITOR_CONFIGS = {
         ]),
     }
 }
-
-LICENCE_INFORMATION = []
-
-packages = list(get_app_packages())
-packages.insert(0, "aleksis.core")
-
-for app in packages:
-    app_mod = import_module(app)
-    try:
-        licence_information = app_mod.LICENCE_INFORMATION
-        LICENCE_INFORMATION.append(licence_information)
-    except AttributeError:
-        pass
diff --git a/aleksis/core/views.py b/aleksis/core/views.py
index 3800cfa08..a627f6c9d 100644
--- a/aleksis/core/views.py
+++ b/aleksis/core/views.py
@@ -1,3 +1,4 @@
+from importlib import import_module
 from typing import Optional
 
 from django.contrib.auth.decorators import login_required
@@ -5,7 +6,6 @@ from django.core.exceptions import PermissionDenied
 from django.http import Http404, HttpRequest, HttpResponse
 from django.shortcuts import get_object_or_404, redirect, render
 from django.utils.translation import ugettext_lazy as _
-from django.conf import settings
 
 from django_tables2 import RequestConfig
 
@@ -20,6 +20,7 @@ from .forms import (
 from .models import Activity, Group, Notification, Person, School, DashboardWidget
 from .tables import GroupsTable, PersonsTable
 from .util import messages
+from .util.core_helpers import get_app_packages
 
 
 @person_required
@@ -46,10 +47,23 @@ def offline(request):
 def about(request):
     context = {}
 
-    context["licence_information"] = settings.LICENCE_INFORMATION
+    licence_information = []
+
+    packages = list(get_app_packages())
+    packages.insert(0, "aleksis.core")
+
+    for app in packages:
+        app_mod = import_module(app)
+        try:
+            licence_information.append(app_mod.LICENCE_INFORMATION)
+        except AttributeError:
+            pass
+
+    context["licence_information"] = licence_information
 
     return render(request, "core/about.html", context)
 
+
 @login_required
 def persons(request: HttpRequest) -> HttpResponse:
     context = {}
-- 
GitLab