djangofloor.conf.merger
¶
Classes and functions used for the DjangoFloor settings system¶
Define several helpers classes and internal functions for the DjangoFloor settings system, allowing to merge settings from different sources. This file must be importable while Django is not loaded yet.
-
class
djangofloor.conf.merger.
SettingMerger
(fields_provider, providers, extra_values=None, stdout=None, stderr=None, no_color=False)[source]¶ Load different settings modules and config files and merge them.
-
analyze_raw_value
(obj, provider_name, setting_name)[source]¶ Parse the object for replacing variables by their values.
If obj is a string like “THIS_IS_{TEXT}”, search for a setting named “TEXT” and replace {TEXT} by its value (say, “VALUE”). The returned object is then equal to “THIS_IS_VALUE”. If obj is a list, a set, a tuple or a dict, its components are recursively parsed. If obj is a subclass of
djangofloor.conf.config_values.ConfigValue
, its value is on-the-fly computed. Otherwise, obj is returned as-is.Parameters: - obj – object to analyze
- provider_name – the name of the config file
- setting_name – the name of the setting containing this value but this value can be inside a dict or a list (like SETTING = [Directory(“/tmp”), ])
Returns: the parsed setting
-
call_method_on_config_values
(method_name: str)[source]¶ Scan all settings, looking for
django.conf.config_values.ConfigValue
and calling one of their methods.Parameters: method_name – ‘pre_collectstatic’, ‘pre_migrate’, ‘post_collectstatic’, or ‘post_migrate’.
-