Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
4999abf1
Verified
Commit
4999abf1
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Move crawling of app licence information to core_helpers
parent
48ec91e6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!146
Resolve "Add licence information page"
Pipeline
#806
passed with warnings
5 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/util/core_helpers.py
+21
-1
21 additions, 1 deletion
aleksis/core/util/core_helpers.py
aleksis/core/views.py
+2
-16
2 additions, 16 deletions
aleksis/core/views.py
with
23 additions
and
17 deletions
aleksis/core/util/core_helpers.py
+
21
−
1
View file @
4999abf1
import
os
import
pkgutil
from
importlib
import
import_module
from
typing
import
Any
,
Callable
,
Sequence
,
Union
from
typing
import
Any
,
Callable
,
Sequence
,
Union
,
List
from
uuid
import
uuid4
from
django.conf
import
settings
...
...
@@ -148,3 +148,23 @@ def school_information_processor(request: HttpRequest) -> dict:
return
{
"
SCHOOL
"
:
School
.
get_default
,
}
def
get_app_licence_information
()
->
List
[
dict
]:
"""
Get a list of the attribute LICENCE_INFORMATION from every app and the core
"""
licence_information
=
[]
packages
=
list
(
get_app_packages
())
packages
.
insert
(
0
,
"
aleksis.core
"
)
for
app
in
packages
:
app_mod
=
import_module
(
app
)
try
:
app_licence_information
=
app_mod
.
LICENCE_INFORMATION
app_licence_information
[
"
copyright_holders
"
].
sort
(
key
=
lambda
x
:
x
[
1
].
split
(
"
"
)[
-
1
])
licence_information
.
append
(
app_licence_information
)
except
AttributeError
:
pass
return
licence_information
This diff is collapsed.
Click to expand it.
aleksis/core/views.py
+
2
−
16
View file @
4999abf1
...
...
@@ -20,7 +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
from
.util.core_helpers
import
get_app_
licence_information
@person_required
...
...
@@ -47,21 +47,7 @@ def offline(request):
def
about
(
request
):
context
=
{}
licence_information
=
[]
packages
=
list
(
get_app_packages
())
packages
.
insert
(
0
,
"
aleksis.core
"
)
for
app
in
packages
:
app_mod
=
import_module
(
app
)
try
:
app_licence_information
=
app_mod
.
LICENCE_INFORMATION
app_licence_information
[
"
copyright_holders
"
].
sort
(
key
=
lambda
x
:
x
[
1
].
split
(
"
"
)[
-
1
])
licence_information
.
append
(
app_licence_information
)
except
AttributeError
:
pass
context
[
"
licence_information
"
]
=
licence_information
context
[
"
licence_information
"
]
=
get_app_licence_information
()
return
render
(
request
,
"
core/about.html
"
,
context
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment