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
d3578f67
Verified
Commit
d3578f67
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Define API for app metadata, copyright and license information
parent
a8b649b3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!146
Resolve "Add licence information page"
Pipeline
#1497
failed
5 years ago
Stage: test
Stage: build
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
aleksis/core/__init__.py
+0
-15
0 additions, 15 deletions
aleksis/core/__init__.py
aleksis/core/apps.py
+14
-0
14 additions, 0 deletions
aleksis/core/apps.py
aleksis/core/util/apps.py
+46
-0
46 additions, 0 deletions
aleksis/core/util/apps.py
pyproject.toml
+2
-0
2 additions, 0 deletions
pyproject.toml
with
62 additions
and
15 deletions
aleksis/core/__init__.py
+
0
−
15
View file @
d3578f67
...
...
@@ -14,18 +14,3 @@ except Exception:
__version__
=
"
unknown
"
default_app_config
=
"
aleksis.core.apps.CoreConfig
"
LICENCE_INFORMATION
=
{
"
name
"
:
_
(
"
Core
"
),
"
repository
"
:
"
https://edugit.org/AlekSIS/AlekSIS/
"
,
"
licence
"
:
_
(
"
EUPL, version 1.2 or later
"
),
"
copyright_holders
"
:
[
([
2017
,
2018
,
2019
,
2020
],
"
Jonathan Weth
"
,
"
wethjo@katharineum.de
"
),
([
2017
,
2018
,
2019
],
"
Frank Poetzsch-Heffter
"
,
"
p-h@katharineum.de
"
),
([
2018
,
2019
,
2020
],
"
Hangzhi Yu
"
,
"
yuha@katharineum.de
"
),
([
2018
,
2019
,
2020
],
"
Julian Leucker
"
,
"
leuckeju@katharineum.de
"
),
([
2019
,
2020
],
"
Dominik George
"
,
"
dominik.george@teckids.org
"
),
([
2019
,
2020
],
"
mirabilos
"
,
"
thorsten.glaser@teckids.org
"
),
([
2019
,
2020
],
"
Tom Teichler
"
,
"
tom.teichler@teckids.org
"
),
]
}
This diff is collapsed.
Click to expand it.
aleksis/core/apps.py
+
14
−
0
View file @
d3578f67
...
...
@@ -13,6 +13,20 @@ class CoreConfig(AppConfig):
name
=
"
aleksis.core
"
verbose_name
=
"
AlekSIS — The Free School Information System
"
urls
=
{
"
Repository
"
:
"
https://edugit.org/AlekSIS/official/AlekSIS/
"
,
}
licence
=
"
EUPL-1.2+
"
copyright
=
(
([
2017
,
2018
,
2019
,
2020
],
"
Jonathan Weth
"
,
"
wethjo@katharineum.de
"
),
([
2017
,
2018
,
2019
],
"
Frank Poetzsch-Heffter
"
,
"
p-h@katharineum.de
"
),
([
2018
,
2019
,
2020
],
"
Hangzhi Yu
"
,
"
yuha@katharineum.de
"
),
([
2018
,
2019
,
2020
],
"
Julian Leucker
"
,
"
leuckeju@katharineum.de
"
),
([
2019
,
2020
],
"
Dominik George
"
,
"
dominik.george@teckids.org
"
),
([
2019
,
2020
],
"
mirabilos
"
,
"
thorsten.glaser@teckids.org
"
),
([
2019
,
2020
],
"
Tom Teichler
"
,
"
tom.teichler@teckids.org
"
),
)
def
config_updated
(
self
,
*
args
,
**
kwargs
)
->
None
:
clean_scss
()
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/apps.py
+
46
−
0
View file @
d3578f67
...
...
@@ -7,6 +7,8 @@ from django.db.models.signals import post_migrate, pre_migrate
from
django.http
import
HttpRequest
from
constance.signals
import
config_updated
from
license_expression
import
Licensing
,
LicenseSymbol
from
spdx_license_list
import
LICENSES
class
AppConfig
(
django
.
apps
.
AppConfig
):
...
...
@@ -41,6 +43,50 @@ class AppConfig(django.apps.AppConfig):
# ImportErrors are non-fatal because checks are optional.
pass
def
get_name
(
self
):
return
getattr
(
self
,
"
verbose_name
"
,
self
.
name
)
# TODO Try getting from distribution if not set
def
get_version
(
self
):
try
:
from
..
import
__version__
# noqa
except
ImportError
:
__version__
=
None
return
getattr
(
self
,
"
version
"
,
__version__
)
def
get_licence
(
self
)
->
Tuple
:
licence
=
getattr
(
self
,
"
licence
"
,
None
)
default_dict
=
{
'
isDeprecatedLicenseId
'
:
False
,
'
isFsfLibre
'
:
False
,
'
isOsiApproved
'
:
False
,
'
licenseId
'
:
'
unknown
'
,
'
name
'
:
'
Unknown Licence
'
,
'
referenceNumber
'
:
-
1
,
'
url
'
:
''
,
}
if
licence
:
licensing
=
Licensing
(
LICENSES
.
keys
())
parsed
=
licensing
.
parse
(
licence
).
simplify
()
readable
=
parsed
.
render_as_readable
()
licence_dicts
=
[
LICENSES
.
get
(
symbol
.
key
,
default_dict
)
for
symbol
in
parsed
.
symbols
]
return
(
readable
,
licence_dicts
)
else
:
return
(
"
Unknown
"
,
[
default_dict
])
def
get_urls
(
self
):
return
getattr
(
self
,
"
urls
"
,
{})
# TODO Try getting from distribution if not set
def
get_copyright
(
self
):
return
getattr
(
self
,
"
copyright
"
,
tuple
())
# TODO Try getting from distribution if not set
def
config_updated
(
self
,
key
:
Optional
[
str
]
=
""
,
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
2
−
0
View file @
d3578f67
...
...
@@ -71,6 +71,8 @@ django-memoize = "^2.2.1"
django-haystack
=
"^3.0"
celery-haystack
=
{
version
=
"^0.3.1"
,
optional
=
true
}
django-dbbackup
=
"^3.3.0"
spdx-license-list
=
"^0.4.0"
license-expression
=
"^1.2"
[
tool.poetry.extras
]
ldap
=
[
"django-auth-ldap"
]
...
...
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