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
2229692f
Verified
Commit
2229692f
authored
4 years ago
by
Nik | Klampfradler
Committed by
Jonathan Weth
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Rename lazy_config to lazy_preference and add section as argument
parent
d139058c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!217
Migrate from constance to dynamic-preferences
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/settings.py
+4
-4
4 additions, 4 deletions
aleksis/core/settings.py
aleksis/core/util/core_helpers.py
+3
-3
3 additions, 3 deletions
aleksis/core/util/core_helpers.py
with
7 additions
and
7 deletions
aleksis/core/settings.py
+
4
−
4
View file @
2229692f
...
...
@@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
from
dynaconf
import
LazySettings
from
easy_thumbnails.conf
import
Settings
as
thumbnail_settings
from
.util.core_helpers
import
get_app_packages
,
lazy_
config
,
merge_app_settings
from
.util.core_helpers
import
get_app_packages
,
lazy_
preference
,
merge_app_settings
ENVVAR_PREFIX_FOR_DYNACONF
=
"
ALEKSIS
"
DIRS_FOR_DYNACONF
=
[
"
/etc/aleksis
"
]
...
...
@@ -410,9 +410,9 @@ if _settings.get("celery.enabled", False):
INSTALLED_APPS
+=
(
"
djcelery_email
"
,)
EMAIL_BACKEND
=
"
djcelery_email.backends.CeleryEmailBackend
"
PWA_APP_NAME
=
lazy_config
(
"
SITE_TITLE
"
)
PWA_APP_DESCRIPTION
=
lazy_config
(
"
SITE_DESCRIPTION
"
)
PWA_APP_THEME_COLOR
=
lazy_config
(
"
COLOUR_PRIMARY
"
)
PWA_APP_NAME
=
lazy_config
(
"
general
"
,
"
title
"
)
PWA_APP_DESCRIPTION
=
lazy_config
(
"
general
"
,
"
description
"
)
PWA_APP_THEME_COLOR
=
lazy_config
(
"
theme
"
,
"
primary
"
)
PWA_APP_BACKGROUND_COLOR
=
"
#ffffff
"
PWA_APP_DISPLAY
=
"
standalone
"
PWA_APP_ORIENTATION
=
"
any
"
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/core_helpers.py
+
3
−
3
View file @
2229692f
...
...
@@ -88,14 +88,14 @@ def merge_app_settings(setting: str, original: Union[dict, list], deduplicate: b
raise
TypeError
(
"
Only dict and list settings can be merged.
"
)
def
lazy_
config
(
key
:
str
)
->
Callable
[[
str
],
Any
]:
def
lazy_
preference
(
section
:
str
,
name
:
str
)
->
Callable
[[
str
,
str
],
Any
]:
"""
Lazily get a config value from dynamic preferences. Useful to bind preferences
to other global settings to make them available to third-party apps that are not
aware of dynamic preferences.
"""
def
_get_
config
(
key
:
str
)
->
Any
:
return
global_preferences
[
key
]
def
_get_
preference
(
section
:
str
,
name
:
str
)
->
Any
:
return
global_preferences
[
"
%s__%s
"
%
(
section
,
name
)
]
# The type is guessed from the default value to improve lazy()'s behaviour
# FIXME Reintroduce the behaviour described above
...
...
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