gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[www_shared] 01/03: FC: YAML multifile read; Added global variable to co


From: gnunet
Subject: [www_shared] 01/03: FC: YAML multifile read; Added global variable to configure properties file
Date: Mon, 20 Nov 2023 11:49:03 +0100

This is an automated email from the git hooks/post-receive script.

andreas-habegger pushed a commit to branch master
in repository www_shared.

commit 12caf5a526eb0f72627f6849ba96895dd505ec18
Author: Andreas HABEGGER <andreas.habegger@bfh.ch>
AuthorDate: Sun Nov 19 22:36:34 2023 +0100

    FC: YAML multifile read; Added global variable to configure properties file
---
 sitegen/site.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sitegen/site.py b/sitegen/site.py
index e2b20c0..6139d1c 100644
--- a/sitegen/site.py
+++ b/sitegen/site.py
@@ -34,6 +34,8 @@ import sitegen.i18nfix as i18nfix
 from sitegen.timeutil import time_rfc822, time_now, conv_date_rfc822
 
 
+PROPERTIES_YML = "properties.yml"
+
 def html2text(html_str):
     class extractText(html.parser.HTMLParser):
         def __init__(self):
@@ -195,9 +197,16 @@ class SiteGenerator:
         env.filters["extract_body"] = extract_body
         env.newstyle_gettext = True
         self.env = env
+        # NOTE : read-in properties.yml and afterwards all *.yml in 
properties.d
+        properties = {}
         yaml = YAML(typ="safe")
-        site_configfile = self.root / "www.yml"
-        self.config = yaml.load(site_configfile)
+        yaml.preserve_quotes = True
+        properties.update(yaml.load(self.root/PROPERTIES_YML))
+        properties_dir =  PROPERTIES_YML.removesuffix('.yml') + '.d'
+        for filepath in Path(self.root/properties_dir).glob('*.yml'):
+            properties.update(yaml.load(filepath))
+        self.config = properties
+
         self.baseurl = os.environ.get("BASEURL")
         if not self.baseurl:
             self.baseurl = self.config["siteconf"].get("baseurl")

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]