zpp_config 2.2.3__tar.gz → 2.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. {zpp_config-2.2.3/zpp_config.egg-info → zpp_config-2.2.4}/PKG-INFO +1 -1
  2. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/config.py +22 -5
  3. {zpp_config-2.2.3 → zpp_config-2.2.4/zpp_config.egg-info}/PKG-INFO +1 -1
  4. {zpp_config-2.2.3 → zpp_config-2.2.4}/LICENSE +0 -0
  5. {zpp_config-2.2.3 → zpp_config-2.2.4}/README.md +0 -0
  6. {zpp_config-2.2.3 → zpp_config-2.2.4}/setup.cfg +0 -0
  7. {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_access.py +0 -0
  8. {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_backends.py +0 -0
  9. {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_merge_update_delete.py +0 -0
  10. {zpp_config-2.2.3 → zpp_config-2.2.4}/tests/test_validation.py +0 -0
  11. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/__init__.py +0 -0
  12. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/__init__.py +0 -0
  13. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/cfg.py +0 -0
  14. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/global_backend.py +0 -0
  15. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/ini.py +0 -0
  16. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/json.py +0 -0
  17. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/toml.py +0 -0
  18. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/backend/yaml.py +0 -0
  19. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/cli.py +0 -0
  20. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/__init__.py +0 -0
  21. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/autoreload.py +0 -0
  22. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/logs.py +0 -0
  23. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/vault.py +0 -0
  24. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config/core/vault_encryption.py +0 -0
  25. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/SOURCES.txt +0 -0
  26. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/dependency_links.txt +0 -0
  27. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/entry_points.txt +0 -0
  28. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/requires.txt +0 -0
  29. {zpp_config-2.2.3 → zpp_config-2.2.4}/zpp_config.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zpp_config
3
- Version: 2.2.3
3
+ Version: 2.2.4
4
4
  Summary: Module pour le chargement et la modification de fichier de configuration
5
5
  Home-page: https://github.com/ZephyrOff/zpp_config
6
6
  Author:
@@ -384,7 +384,7 @@ class Config(ConfigNode):
384
384
  {'module':'jinja2', 'submodule': ['Environment']},
385
385
  {'module':'zpp_config.core.vault_encryption', 'submodule': ['vault_decrypt']},
386
386
  )
387
- def __init__(self, filename, filetype=None, context=None, vault_file=None, vault_keyfile=None, vault_password=None, vault_encryption_keyfile=None, vault_encryption_password=None):
387
+ def __init__(self, filename, filetype=None, context=None, vault_file=None, vault_keyfile=None, vault_password=None, vault_encryption_keyfile=None, vault_encryption_password=None, disable_jinja_render=False):
388
388
  self._filename = Path(filename)
389
389
  self._context = context or {}
390
390
 
@@ -404,6 +404,7 @@ class Config(ConfigNode):
404
404
  loader=SafeFileSystemLoader(self._filename.parent),
405
405
  autoescape=False
406
406
  )
407
+ self._disable_jinja_render = disable_jinja_render
407
408
 
408
409
  # Fonction pour récupérer une clé dans un vault
409
410
  def vault(key):
@@ -461,18 +462,34 @@ class Config(ConfigNode):
461
462
  self._loaded = False
462
463
  super().__init__(path="", _data={})
463
464
 
465
+ def _read_source(self):
466
+ """
467
+ Read file content using the Jinja loader logic
468
+ (handles UTF-8 + Windows cp1252 fallback).
469
+ """
470
+ # On passe volontairement par le loader Jinja
471
+ source, _, _ = self._env.loader.get_source(
472
+ self._env, self._filename.name
473
+ )
474
+ return source
475
+
464
476
  def load(self):
465
477
  """Render Jinja + parse via backend"""
466
478
  if not self._filename.exists():
467
479
  self._data = {}
468
480
  self._loaded = True
481
+ return
482
+
483
+ raw = self._read_source()
469
484
 
485
+ if self._disable_jinja_render:
486
+ data = raw
470
487
  else:
471
- template = self._env.get_template(self._filename.name)
472
- data_render = template.render(**self._context)
488
+ template = self._env.from_string(raw)
489
+ data = template.render(**self._context)
473
490
 
474
- self._data = self._backend.load_data(data_render)
475
- self._loaded = True
491
+ self._data = self._backend.load_data(data)
492
+ self._loaded = True
476
493
 
477
494
  def reload(self):
478
495
  """Re-render si le context a changé"""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: zpp_config
3
- Version: 2.2.3
3
+ Version: 2.2.4
4
4
  Summary: Module pour le chargement et la modification de fichier de configuration
5
5
  Home-page: https://github.com/ZephyrOff/zpp_config
6
6
  Author:
File without changes
File without changes
File without changes
File without changes