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
cfe89d38
Verified
Commit
cfe89d38
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
f6c4bbd3
92537de7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#622
failed
5 years ago
Stage: test
Stage: build
Stage: deploy
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
aleksis/core/settings.py
+11
-1
11 additions, 1 deletion
aleksis/core/settings.py
aleksis/core/templates/core/turnable.html
+8
-24
8 additions, 24 deletions
aleksis/core/templates/core/turnable.html
aleksis/core/util/core_helpers.py
+32
-10
32 additions, 10 deletions
aleksis/core/util/core_helpers.py
with
51 additions
and
35 deletions
aleksis/core/settings.py
+
11
−
1
View file @
cfe89d38
...
...
@@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _
from
dynaconf
import
LazySettings
from
easy_thumbnails.conf
import
Settings
as
thumbnail_settings
from
.util.core_helpers
import
get_app_packages
from
.util.core_helpers
import
get_app_packages
,
merge_app_settings
ENVVAR_PREFIX_FOR_DYNACONF
=
"
ALEKSIS
"
DIRS_FOR_DYNACONF
=
[
"
/etc/aleksis
"
]
...
...
@@ -77,6 +77,7 @@ INSTALLED_APPS = [
"
pwa
"
,
]
merge_app_settings
(
"
INSTALLED_APPS
"
,
INSTALLED_APPS
,
True
)
INSTALLED_APPS
+=
get_app_packages
()
STATICFILES_FINDERS
=
[
...
...
@@ -150,6 +151,8 @@ DATABASES = {
}
}
merge_app_settings
(
"
DATABASES
"
,
DATABASES
,
False
)
if
_settings
.
get
(
"
caching.memcached.enabled
"
,
True
):
CACHES
=
{
"
default
"
:
{
...
...
@@ -239,6 +242,8 @@ YARN_INSTALLED_APPS = [
"
select2
"
,
]
merge_app_settings
(
"
YARN_INSTALLED_APPS
"
,
YARN_INSTALLED_APPS
,
True
)
JS_URL
=
_settings
.
get
(
"
js_assets.url
"
,
STATIC_URL
)
JS_ROOT
=
_settings
.
get
(
"
js_assets.root
"
,
NODE_MODULES_ROOT
+
"
/node_modules
"
)
...
...
@@ -255,6 +260,8 @@ ANY_JS = {
},
}
merge_app_settings
(
"
ANY_JS
"
,
ANY_JS
,
True
)
SASS_PROCESSOR_AUTO_INCLUDE
=
False
SASS_PROCESSOR_CUSTOM_FUNCTIONS
=
{
"
get-colour
"
:
"
aleksis.core.util.sass_helpers.get_colour
"
,
...
...
@@ -302,6 +309,9 @@ CONSTANCE_CONFIG_FIELDSETS = {
"
Footer settings
"
:
(
"
PRIVACY_URL
"
,
"
IMPRINT_URL
"
),
}
merge_app_settings
(
"
CONSTANCE_CONFIG
"
,
CONSTANCE_CONFIG
,
False
)
merge_app_settings
(
"
CONSTANCE_CONFIG_FIELDSETS
"
,
CONSTANCE_CONFIG_FIELDSETS
,
False
)
MAINTENANCE_MODE
=
_settings
.
get
(
"
maintenance.enabled
"
,
None
)
MAINTENANCE_MODE_IGNORE_IP_ADDRESSES
=
_settings
.
get
(
"
maintenance.ignore_ips
"
,
_settings
.
get
(
"
maintenance.internal_ips
"
,
[])
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/templates/core/turnable.html
+
8
−
24
View file @
cfe89d38
{# -*- engine:django -*- #}
{% extends "core/base.html" %}
{% block content %}
<div
class=
"d-flex justify-content-between"
>
<div>
<h2>
{{ current_head }}
</h2>
</div>
<div
class=
"btn-group"
role=
"group"
aria-label=
"URL actions"
>
<a
href=
"{{ url_prev }}"
class=
"btn btn-dark"
>
<i
class=
"material-icons"
>
chevron_left
</i>
</a>
<a
href=
"{{ url_next }}"
class=
"btn btn-dark"
>
<i
class=
"material-icons"
>
chevron_right
</i>
</a>
</div>
</div>
{% block current_content %}
{% endblock %}
{% endblock %}
<div
class=
"row"
>
<a
href=
"{{ url_prev }}"
class=
"btn-flat left"
>
<i
class=
"material-icons small"
>
chevron_left
</i>
</a>
<a
href=
"{{ url_next }}"
class=
"btn-flat right"
>
<i
class=
"material-icons small"
>
chevron_right
</i>
</a>
</div>
This diff is collapsed.
Click to expand it.
aleksis/core/util/core_helpers.py
+
32
−
10
View file @
cfe89d38
...
...
@@ -30,19 +30,41 @@ def get_app_packages() -> Sequence[str]:
except
ImportError
:
return
[]
pkgs
=
[]
for
pkg
in
pkgutil
.
iter_modules
(
aleksis
.
apps
.
__path__
):
mod
=
import_module
(
"
aleksis.apps.%s
"
%
pkg
[
1
])
return
[
"
aleksis.apps.%s
"
%
pkg
[
1
]
for
pkg
in
pkgutil
.
iter_modules
(
aleksis
.
apps
.
__path__
)]
# Add additional apps defined in module's INSTALLED_APPS constant
additional_apps
=
getattr
(
mod
,
"
INSTALLED_APPS
"
,
[])
for
app
in
additional_apps
:
if
app
not
in
pkgs
:
pkgs
.
append
(
app
)
pkgs
.
append
(
"
aleksis.apps.%s
"
%
pkg
[
1
])
def
merge_app_settings
(
setting
:
str
,
original
:
Union
[
dict
,
list
],
deduplicate
:
bool
=
False
)
->
Union
[
dict
,
list
]:
"""
Get a named settings constant from all apps and merge it into the original.
To use this, add a settings.py file to the app, in the same format as Django
'
s
main settings.py.
return
pkgs
Note: Only selected names will be imported frm it to minimise impact of
potentially malicious apps!
"""
for
pkg
in
get_app_packages
():
try
:
mod_settings
=
import_module
(
pkg
)
except
ImportError
:
# Import errors are non-fatal. They mean that the app has no settings.py.
continue
app_setting
=
getattr
(
mod_settings
,
setting
,
None
)
if
not
app_setting
:
# The app might not have this setting or it might be empty. Ignore it in that case.
continue
for
entry
in
app_setting
:
if
entry
in
original
:
if
not
deduplicate
:
raise
AttributeError
(
"
%s already set in original.
"
)
else
:
if
isinstance
(
original
,
list
):
original
.
append
(
entry
)
elif
isinstance
(
original
,
dict
):
original
[
entry
]
=
app_setting
[
entry
]
else
:
raise
TypeError
(
"
Only dict and list settings can be merged.
"
)
def
is_impersonate
(
request
:
HttpRequest
)
->
bool
:
...
...
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