From beecb0ee5ea96d8c0277c22001b557034b659f48 Mon Sep 17 00:00:00 2001 From: Cyrille LOUARN Date: Wed, 27 Sep 2023 09:30:07 +0200 Subject: [PATCH] bug when new or updating domain configuration file --- CHANGELOG.md | 3 + README.md | 2 +- src/usr/bin/tyto | 4 +- .../program/__pycache__/check.cpython-311.pyc | Bin 872 -> 736 bytes .../__pycache__/domain.cpython-311.pyc | Bin 21556 -> 27268 bytes .../program/__pycache__/forms.cpython-311.pyc | Bin 8827 -> 8779 bytes .../program/__pycache__/post.cpython-311.pyc | Bin 3926 -> 3893 bytes .../program/__pycache__/tyto.cpython-311.pyc | Bin 2203 -> 2241 bytes src/var/lib/tyto/program/check.py | 3 +- src/var/lib/tyto/program/domain.py | 491 ++++++++++++------ src/var/lib/tyto/program/forms.py | 48 +- src/var/lib/tyto/program/post.py | 12 +- src/var/lib/tyto/program/tyto.py | 11 +- 13 files changed, 350 insertions(+), 224 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 81672e3..c618bdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,9 @@ Tyto - Littérateur - License: - Documentation: +## [1.9.7] +- new process to check and update configuration file (bug at write some values) + ## [1.9.6] - Better management to create/update domain diff --git a/README.md b/README.md index 3646fe3..0a56932 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ tyto ``` ## ToDo next (working on) +- Manage domain configuration file values - check action -- target post exists and compatible - create template post database diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index 004eafd..4a53280 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Version: 1.9.6 -# Updated: 2023-09-26 1695738690 +# Version: 1.9.7 +# Updated: 2023-09-27 1695799605 # Tyto - Littérateur # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc index 8bd2865a2d481bb6017f037778287dba1b9e00cf..ef739a781c5dfc71ac3580bb1fa7f5f98368396d 100644 GIT binary patch delta 352 zcmaFC_JEadIWI340}wbB3a2u#Pvpz3X9n^>`13L#F`c1=5lBHn7Mz{JxD3c%4d*j5 z)G#h!f~iBMQ_}$?q8*%|Sjd0(q+l6fH%(K;jl_Nq&A#aS_Pel?+9q jAaRgCe{tC4=BJeAq}mlpPR?YCmSJU-`M`ilfOP->5&>iZ diff --git a/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc index 86a913d21c407c416cd4ab839fb9232aceb234aa..5c8f9bdcf6505069160d1e7356454a7b44a47365 100644 GIT binary patch literal 27268 zcmeHwTWl1`mS9#^W>sZ9Tz+HxEc~SWDjS>k>zW3Gp)q|M1C8l!-@;i28{_iLN@H*r zcM6tW+$;>9R=23RYR}Z{j(ckF-IlD?TrD4~Rr5Ey+K)^tM{T8K>1tOkEwj>yRqseG zK301opONVT%7&KaW7Abpk&$sC&N*@7#EFQEF6Gxf>}JV(#IT2TLddWb zgkF}0(8szU^s{aV1FQ$a0+xX=$a*0xWPK18v3>}P*#Lwk3_%hxVxm+>^Bai#UcVvO zf;or}mqCtlJu$OIkKw;;@EZp}!dJb9E2gR&2nQti^QxWR+g#M)A3)n)LI8i7zGos<%Kj=v=~oEjb$TCwe?qWo;$v-Eb3IIoxb1 ztJct#nSd($`WTmX94!^!IzHC=cvTz2;n(*^zvvYKgkX~N4SM)**O`T zlBuca^_cA964R68yiBvP%QIJGXMBeLcf^mV+Lv{a8&NJYIet09-{RwuX)b<+i(Zeg z@$1p?sm|$Ja&R<$eLBjIU!IJOpu)I90BePBVgP~^u||6yl|HU|P_=MYWVTAoR*|lh z=*o0-g{~9mx;2WqH!vSv*t&Q$)0lN+dqt{CqPhhA^TJ8ELXeLufYK~Yfv8fN;y*yd z+7wnLIbFh|eA+c(G>yGE90W^7oxDB}K>i6@hq9IkxeUb!jg7_i{2&epVeP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C@N%l=~&_yV%&Cy;1h_`t-<%sct6yrIYkCPrr7 z8(cgM&L9Z%$pco7&1wpEjEuaKQx)fxb1+JOV1N@U(jYFJ@L+_?fYm6WaRnG5HxPeXt0NEFb%>V!Z delta 486 zcmX@@^4o=PIWI340}z~hDU^Ctek0#M4#p{yc{#PYKCrMbvwh`Z5SN*3!`aHTg=z9Z z;Rq&9hRxDkrOa$iKrO|Ulc(_l6*2)8e&Ax@72JG;*Oi%Z)n+b1W+wK7AQe*>CQs*; z6BC{w)S&``KYsiGD~FhSQOtaErLZzH+jWpyW}s>ExRt(P+QBqgM%HCBqr_Zhzt12Y zF^mih4GbTcn3?(RatroY_S<&Z&X8Q-c9C2A3b*zJZs)b7SM(h(>N{W2cW!WLZ~@xQ z$jomS9*e3^aiEQ2{ z`-D+I1ZZdRU!d(Ei&>b3CvTEBl(@kpG=Zr@83bX5e&AtX z=?@HW!ayFxg%bgca2c=~JzkJBoX`NW}CoH5HB|k902`5HLMu`s$m_!jb(47ER C@{4-_ diff --git a/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/post.cpython-311.pyc index 6b4965862e2e017123d836b28fab09bc74953183..1dc8c493d3ec7b1a262890455bf35bb5e83d84fa 100644 GIT binary patch delta 765 zcmZ`%&ubGw6rS1No6RQ1kaVL>g0U%0qpgQnOHn~E77;})6c3fS&2CFdG&-3SR1^;$ z>P3vN;z{)2PedsM!DEk}gq6j@qJKl9C-LM?($rS)!F==f&G*gwcspNHA5!`&T@N5X znoiVy*wpXgndam55Z%FQ-B?iJnjD8!oZv-Ef^RshbrkIMnFc?k7@XvT5XLHuagjuj z3L8RyTlmY=850{&lMT4fC1lxBsDTii#VL*^;WM}URC2yL5E9NK&mYY-9) z7!@+O56%n2`EYrz)Ton^Nob{9wdUMR8+WhRB&9ahHX+*5E~IKLbXNkFBBE&O1WAcTCN~8`Rm3jh zLNJ_#n@THaE4T>+B|pO{LyG}%EeP$hbmiQHQR9Jg`0jVlT|` z7oRuPm)K~&IXtEFI~bu)w)d?Xf`>T5=mKowQBKsQb=YDe@B=Gu$;sK4!4v`@Gik4j za1M*mssz7q0tewPlM`j#MS=)H9>+Oy8lmRb@FGTJ=$~|tgK45;x_gJQ1=-%Wf_HF) z!~YTC$@(0Q#2ti?uGH?!24{8g*6*lN0>AwwEL(pYo zDRuD#XMa+8b!B2!D;T77uUxEVm+DL=TW2$wEcmz-4#P$6TtsoM@8~6?%j?CJ+WjtD zsX>EV5CwgO((sMbc#b?K6*%S=T`9ZsgzeR3$n)p(lO{7|F;hnfv)Ax&XUQ@SE diff --git a/src/var/lib/tyto/program/__pycache__/tyto.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/tyto.cpython-311.pyc index d3a454d4496051dc702c359de9009d7e939f0773..4f5195bf4fca0f2c25010bee7b3b825c42887f3c 100644 GIT binary patch delta 180 zcmbO&cuJq1&oT!3aZ7M zCo&#lWG$&I$&a5L%=}5BJhMQ-maDwHT)|d>iz_oI9rf+IWI340}wo_6il5ykynz@Zlbz9OE7~b|HeF4Mn?6?C5(!jXD}XOoE*>m zNti1-+%q8F#WN^4ma8Z~zeK@SVR9x*HyeZvWGZYHX4PThs$$gz0Y6Q?$sz2kCUbCD fa;XC?VFcph^vT{F@d8PV3_QXO93WVv3KRwaQy3zM diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 1909e19..5ba563d 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -43,7 +43,8 @@ import domain, langs, debug, post, tools #-------------------------------------------# def manage(action, target): # Load domain configuration (update it if needed), check if valid - domain.cf_valid() or debug.out(105, domain.name, domain.cf_uri, True, 1, True) + #domain.cf_valid() or debug.out(105, domain.name, domain.cf_uri, True, 1, True) + domain.cf_update_values(False) target.endswith(".tyto") and post.is_article(target) langs.load_website_lang() diff --git a/src/var/lib/tyto/program/domain.py b/src/var/lib/tyto/program/domain.py index 41892b5..033d44e 100644 --- a/src/var/lib/tyto/program/domain.py +++ b/src/var/lib/tyto/program/domain.py @@ -57,12 +57,6 @@ def cf_load(): cf = configparser.ConfigParser() cf.read(cf_uri) - # Set some needed global values - global articles_dir, db_dir - - articles_dir = cf.get("USER_DIRS", "articles") - db_dir = cf.get("USER_DIRS", "database") - #=====================================# # Load User Domain Configuration file # @@ -154,7 +148,7 @@ def cf_create(): forms.ask_domain_shortname(name) # Create default files - tools.create_file(cf_uri, tyto.ini_domain) + tools.create_file(cf_uri, tyto.ini_domain%name) tools.create_dirs(ult_dir) tools.create_file(ult_cf_uri, tyto.ini_domain_user) @@ -177,7 +171,7 @@ def cf_create(): forms.ask_domain_server(True) # Update Domain Configuration file - cf_update_values() + cf_update_values(True) #===========================================# @@ -185,168 +179,334 @@ def cf_create(): # Ask for some values if empty # # Ensure to set correct values # #-------------------------------------------# -def cf_update_values(): - # Prepare Domain Configuration File keys values - #----------------------------------------------- +def cf_update_values(write): + global cf + # Load Domain Configuration file + cf = "" cf_load() + + if cf.get("DOMAIN", "name") != name: + cf.set("DOMAIN", "name", name) + debug.out(204, "[DOMAIN] name", name, False, 0, False) + write = True - # Server - srv = cf.get("SERVER", "root") or \ - cf.set("SERVER", "root", forms.ask_domain_server(False)) + # [SERVER] + global srv + srv = cf.get("SERVER", "root") + if not tools.dir_exists(srv, False): + srv = forms.ask_domain_server(False) + cf.set("SERVER", "root", srv) + debug.out(204, "[SERVER] root", srv, False, 0, False) + write = True + + global srv_name + srv_name = os.path.join(srv, name + "/") + print("domain: srv_name", srv_name) + if cf.get("SERVER", "domain") != srv_name: + cf.set("SERVER", "domain", srv_name) + debug.out(204, "[SERVER] domain", srv_name, False, 0, False) + write = True + + global srv_wip + srv_wip = os.path.join(srv_name, "wip/") + if cf.get("SERVER", "wip") != srv_wip: + cf.set("SERVER", "wip", srv_wip) + debug.out(204, "[SERVER] wip", srv_wip, False, 0, False) + write = True - # Title - cf.get("DOMAIN", "title") or \ - cf.set("DOMAIN", "title", forms.ask_domain_title(False)) + global srv_wip_tpl + srv_wip_tpl = os.path.join(srv_wip, "template/") + if cf.get("WIP_DIRS", "template") != srv_wip_tpl: + cf.set("WIP_DIRS", "template", srv_wip_tpl) + debug.out(204, "[WIP_DIRS] template", srv_wip_tpl, False, 0, False) + write = True + + global srv_wip_images + srv_wip_images = os.path.join(srv_wip, "images/") + if cf.get("WIP_DIRS", "images") != srv_wip_images: + cf.set("WIP_DIRS", "images", srv_wip_images) + debug.out(204, "[WIP_DIRS] images", srv_wip_images, False, 0, False) + write = True + + global srv_wip_files + srv_wip_files = os.path.join(srv_wip, "files/") + if cf.get("WIP_DIRS", "files") != srv_wip_files: + cf.set("WIP_DIRS", "files", srv_wip_files) + debug.out(204, "[WIP_DIRS] files", srv_wip_files, False, 0, False) + write = True + + global srv_www + srv_www = os.path.join(srv_name, "www/") + if cf.get("SERVER", "www") != srv_www: + cf.set("SERVER", "www", srv_www) + debug.out(204, "[SERVER] www", srv_www, False, 0, False) + write = True + + global srv_www_tpl + srv_www_tpl = os.path.join(srv_www, "template/") + if cf.get("WWW_DIRS", "template") != srv_www_tpl: + cf.set("WWW_DIRS", "template", srv_www_tpl) + debug.out(204, "[WWW_DIRS] template", srv_www_tpl, False, 0, False) + write = True - # Date - cf.get("DOMAIN", "date") or \ - cf.set("DOMAIN", "date", forms.ask_domain_date(False)) + global srv_www_images + srv_www_images = os.path.join(srv_www, "images/") + if cf.get("WWW_DIRS", "images") != srv_www_images: + cf.set("WWW_DIRS", "images", srv_www_images) + debug.out(204, "[WWW_DIRS] images", srv_www_images, False, 0, False) + write = True + + global srv_www_files + srv_www_files = os.path.join(srv_www, "files/") + if cf.get("WWW_DIRS", "files") != srv_www_files: + cf.set("WWW_DIRS", "files", srv_www_files) + debug.out(204, "[WWW_DIRS] files", srv_www_files, False, 0, False) + write = True + - # About - cf.get("DOMAIN", "about") or \ - cf.set("DOMAIN", "about", forms.ask_domain_about(False)) + # [DOMAIN] + # ======== + try: cf.getboolean("DOMAIN", "activated") + except: + cf.set("DOMAIN", "activated", "no") + debug.out(204, "[DOMAIN] activated", "no", False, 0, False) + write = True - # mail - cf.get("DOMAIN", "mail") or \ - cf.set("DOMAIN", "mail", forms.ask_domain_mail(False)) + global title + title = cf.get("DOMAIN", "title") + if not title: + cf.set("DOMAIN", "title", forms.ask_domain_title(False)) + write = True - # tags - cf.get("DOMAIN", "tags") or \ - cf.set("DOMAIN", "tags", forms.ask_domain_tags(False)) + global date + date = cf.get("DOMAIN", "date") + if not date: + cf.set("DOMAIN", "date", forms.ask_domain_date(False)) + write = True + + global about + about = cf.get("DOMAIN", "about") + if not about: + cf.set("DOMAIN", "about", forms.ask_domain_about(False)) + write = True + + global mail + mail = cf.get("DOMAIN", "mail") + if not mail: + cf.set("DOMAIN", "mail", forms.ask_domain_mail(False)) + write = True + + global tags + tags = cf.get("DOMAIN", "tags") + if not tags: + cf.set("DOMAIN", "tags", forms.ask_domain_tags(False)) + write = True + + global license, license_url + license = cf.get("DOMAIN", "license") + if not license: + cf.set("DOMAIN", "license", "gfdl-1.3") + write = True + license_url = cf.get("DOMAIN", "license_url") + if license == "gfdl-1.3" and \ + not license_url == "https://www.gnu.org/licenses/fdl-1.3.txt": + cf.set("DOMAIN", "license_url", "https://www.gnu.org/licenses/fdl-1.3.txt") + write = True + + # [WEBSITE] + # ========= + global www_url, wip_url + www_url = cf.get("WEBSITE", "www_url") + if not www_url: + cf.set("WEBSITE", "www_url", "https://%s/"%name) + write = True + + wip_url = cf.get("WEBSITE", "wip_url") + if not wip_url: + cf.set("WEBSITE", "wip_url", create_wip_url()) + write = True + + global lang + lang = cf.get("WEBSITE", "lang") + if not lang: + cf.set("WEBSITE", "lang", forms.ask_domain_lang(False)) + write = True + elif not langs.translation_exists("website", lang, False): + lang = langs.get_sys_lang() + write = True - # Lang - cf.get("WEBSITE", "lang") or \ - cf.set("WEBSITE", "date", forms.ask_domain_lang(False)) langs.load_website_lang() - - # Set URIs from srv uri - srv_dom = os.path.join(srv, name + "/") - srv_wip = os.path.join(srv_dom, "wip/") - srv_www = os.path.join(srv_dom, "www/") - # Set booleans if invalid values - try: cf.getboolean("DOMAIN", "activated") - except: cf.set("DOMAIN", "activated", "no") + global css + css = cf.get("WEBSITE", "css") + if not css: + cf.set("WEBSITE", "css", "tyto") + + global sep + sep = cf.get("WEBSITE", "separator") + if not sep or len(sep) > 2: + cf.set("WEBSITE", "separator", "|") + write = True + + global article_code, static try: cf.getboolean("WEBSITE", "article_code") - except: cf.set("WEBSITE", "article_code", "yes") + except: cf.set("WEBSITE", "article_code", "yes") ; write = True try: cf.getboolean("WEBSITE", "static") - except: cf.set("WEBSITE", "static", "no") + except: cf.set("WEBSITE", "static", "no") ; write = True + + # [WEBSITE_MODULES] + global navbar + try: cf.getboolean("WEBSITE_MODULES", "navbar") + except: cf.set("WEBSITE_MODULES", "navbar", "yes") ; write = True + + global sidebar_title + sidebar_title = cf.get("WEBSITE_MODULES", "sidebar_title") + if not sidebar_title: + cf.set("WEBSITE_MODULES", "sidebar_title", langs.site.sidebar_title) + write = True + + global sidebar_items + sidebar_items = cf.get("WEBSITE_MODULES", "sidebar_items") + if not sidebar_items.isdigit(): + cf.set("WEBSITE_MODULES", "sidebar_items", "0") + write = True + try: cf.getboolean("WEBSITE_MODULES", "sitemaps") - except: cf.set("WEBSITE_MODULES", "sitemaps", "yes") + except: cf.set("WEBSITE_MODULES", "sitemaps", "yes") ; write = True - # Set template filenames to default if none - favicon = cf.get("TEMPLATE_FILENAMES", "favicon") or "favicon.png" - logo = cf.get("TEMPLATE_FILENAMES", "logo") or "logo.png" - styles = cf.get("TEMPLATE_FILENAMES", "styles") or "styles.css" - rss = cf.get("TEMPLATE_FILENAMES", "rss") or "rss.xml" - stats = cf.get("TEMPLATE_FILENAMES", "stats") or "stats.ini" + global rss_items + rss_items = cf.get("WEBSITE_MODULES", "rss_items") + if not rss_items.isdigit(): + cf.set("WEBSITE_MODULES", "rss_items", "0") + write = True + + # TEMPLATE_FILES + # ============== + favicon = cf.get("TEMPLATE_FILENAMES", "favicon") + if not favicon: + favicon = "favicon.png" + cf.set("TEMPLATE_FILENAMES", "favicon", favicon) + write = True + usr_favicon = os.path.join(cf_usr_tpl, favicon) + if cf.get("USER_TEMPLATE_FILES", "favicon") != usr_favicon: + cf.set("USER_TEMPLATE_FILES", "favicon", usr_favicon) + write = True + wip_favicon = os.path.join(srv_wip_tpl, favicon) + if cf.get("WIP_FILES", "favicon") != wip_favicon: + cf.set("WIP_FILES", "favicon", wip_favicon) + write = True + www_favicon = os.path.join(srv_www_tpl, favicon) + if cf.get("WWW_FILES", "favicon") != www_favicon: + cf.set("WWW_FILES", "favicon", www_favicon) + write = True + + logo = cf.get("TEMPLATE_FILENAMES", "logo") + if not logo: + logo = "logo.png" + cf.set("TEMPLATE_FILENAMES", "logo", logo) + write = True + usr_logo = os.path.join(cf_usr_tpl, logo) + if cf.get("USER_TEMPLATE_FILES", "logo") != usr_logo: + cf.set("USER_TEMPLATE_FILES", "logo", usr_logo) + write = True + wip_logo = os.path.join(srv_wip_tpl, logo) + if cf.get("WIP_FILES", "logo") != wip_logo: + cf.set("WIP_FILES", "logo", wip_logo) + write = True + www_logo = os.path.join(srv_www_tpl, logo) + if cf.get("WWW_FILES", "logo") != www_logo: + cf.set("WWW_FILES", "logo", www_logo) + write = True + + styles = cf.get("TEMPLATE_FILENAMES", "styles") + if not styles: + styles = "styles.css" + cf.set("TEMPLATE_FILENAMES", "styles", styles) + write = True + usr_styles = os.path.join(cf_usr_tpl, styles) + if cf.get("USER_TEMPLATE_FILES", "styles") != usr_styles: + cf.set("USER_TEMPLATE_FILES", "styles", usr_styles) + write = True + wip_styles = os.path.join(srv_wip_tpl, styles) + if cf.get("WIP_FILES", "styles") != wip_styles: + cf.set("WIP_FILES", "styles", wip_styles) + write = True + www_styles = os.path.join(srv_www_tpl, styles) + if cf.get("WWW_FILES", "styles") != www_styles: + cf.set("WWW_FILES", "styles", www_styles) + write = True + + rss = cf.get("TEMPLATE_FILENAMES", "rss") + if not rss: + rss = "rss.xml" + cf.set("TEMPLATE_FILENAMES", "rss", rss) + write = True + wip_rss = os.path.join(srv_wip_tpl, rss) + if cf.get("WIP_FILES", "rss") != wip_rss: + cf.set("WIP_FILES", "rss", wip_rss) + write = True + www_rss = os.path.join(srv_www_tpl, rss) + if cf.get("WWW_FILES", "rss") != www_rss: + cf.set("WWW_FILES", "rss", www_rss) + write = True + + stats = cf.get("TEMPLATE_FILENAMES", "stats") + if not stats: + stats = "tyto_stats.ini" + cf.set("TEMPLATE_FILENAMES", "stats", stats) + write = True + wip_stats = os.path.join(srv_wip_tpl, stats) + if cf.get("WIP_FILES", "stats") != wip_stats: + cf.set("WIP_FILES", "stats", wip_stats) + write = True + www_stats = os.path.join(srv_www_tpl, stats) + if cf.get("WWW_FILES", "stats") != www_stats: + cf.set("WWW_FILES", "stats", www_stats) + write = True - # https URLs (www + wip) - cf.get("WEBSITE", "www_url") or \ - cf.set("WEBSITE", "www_url", "https://%s/"%name) - cf.get("WEBSITE", "wip_url") or \ - cf.set("WEBSITE", "wip_url", create_wip_url()) + # [USER_DIRS] + # =========== + if cf.get("USER_DIRS", "root") != cf_dir: + cf.set("USER_DIRS", "root", cf_dir) + write = True + if cf.get("USER_DIRS", "articles") != cf_usr_articles: + cf.set("USER_DIRS", "articles", cf_usr_articles) + write = True + if cf.get("USER_DIRS", "images") != cf_usr_images: + cf.set("USER_DIRS", "images", cf_usr_images) + write = True + if cf.get("USER_DIRS", "files") != cf_usr_files: + cf.set("USER_DIRS", "files", cf_usr_files) + write = True + if cf.get("USER_DIRS", "template") != cf_usr_tpl: + cf.set("USER_DIRS", "template", cf_usr_tpl) + write = True + if cf.get("USER_DIRS", "modules") != cf_usr_mods: + cf.set("USER_DIRS", "modules", cf_usr_mods) + write = True + if cf.get("USER_DIRS", "database") != cf_usr_db: + cf.set("USER_DIRS", "database", cf_usr_db) + write = True - usr_mods = os.path.join(cf_dir, "modules/") - usr_tpl = os.path.join(cf_dir, "template/") - usr_favicon = os.path.join(usr_tpl, favicon) - usr_logo = os.path.join(usr_tpl, logo) - usr_styles = os.path.join(usr_tpl, styles) + # [TYTO] + # ====== + if cf.get("TYTO", "domain_hash") != cf_id: + cf.set("TYTO", "domain_hash", cf_id) + write = True + if cf.get("TYTO", "domain_conf") != cf_uri: + cf.set("TYTO", "domain_conf", cf_uri) + write = True + if cf.get("TYTO", "domain_user") != ult_cf_uri: + cf.set("TYTO", "domain_user", ult_cf_uri) + write = True - wip_tpl = srv_wip + "template/" - wip_favicon = os.path.join(wip_tpl, favicon) - wip_logo = os.path.join(wip_tpl, logo) - wip_styles = os.path.join(wip_tpl, styles) - wip_rss = os.path.join(wip_tpl, rss) - wip_stats = os.path.join(wip_tpl, stats) - - www_tpl = srv_www + "template/" - www_favicon = os.path.join(www_tpl, favicon) - www_logo = os.path.join(www_tpl, logo) - www_styles = os.path.join(www_tpl, styles) - www_rss = os.path.join(www_tpl, rss) - www_stats = os.path.join(www_tpl, stats) - - - # Update Domain Configuration File - #--------------------------------- - cf.set("DOMAIN", "name", name) - cf.set("TYTO", "domain_hash", tools.get_filesum(cf_uri, False)) - cf.set("TYTO", "domain_conf", cf_uri) - cf.set("TYTO", "domain_user", ult_cf_uri) - - # USER - cf.set("USER_DIRS", "root", cf_dir) - cf.set("USER_DIRS", "articles", cf_dir + "articles/") - cf.set("USER_DIRS", "images", cf_dir + "images/") - cf.set("USER_DIRS", "files", cf_dir + "files/") - cf.set("USER_DIRS", "modules", usr_mods) - cf.set("USER_DIRS", "database", cf_dir + ".db/") - cf.set("USER_DIRS", "template", usr_tpl) - cf.set("USER_MODULES_FILES", "metas", usr_mods + "tyto_metas.raw") - cf.set("USER_MODULES_FILES", "header", usr_mods + "tyto_header.raw") - cf.set("USER_MODULES_FILES", "navbar", usr_mods + "tyto_navbar.raw") - cf.set("USER_MODULES_FILES", "sidebar", usr_mods + "tyto_sidebar.raw") - cf.set("USER_MODULES_FILES", "footer", usr_mods + "tyto_footer.raw") - - cf.set("USER_TEMPLATE_FILES", "favicon", usr_favicon) - cf.set("USER_TEMPLATE_FILES", "logo", usr_logo) - cf.set("USER_TEMPLATE_FILES", "styles", usr_styles) - - # WEBSITE - cf.get("WEBSITE_MODULES", "sidebar_title") or \ - cf.set("WEBSITE_MODULES", "sidebar_title", langs.site.sidebar_title) - cf.get("WEBSITE_MODULES", "sidebar_items").isdigit() or \ - cf.set("WEBSITE_MODULES", "sidebar_items", "0") - cf.get("WEBSITE_MODULES", "rss_items").isdigit() or \ - cf.set("WEBSITE_MODULES", "rss_items", "0") - - cf.set("TEMPLATE_FILENAMES", "favicon", favicon) - cf.set("TEMPLATE_FILENAMES", "logo", logo) - cf.set("TEMPLATE_FILENAMES", "styles", styles) - cf.set("TEMPLATE_FILENAMES", "rss", rss) - cf.set("TEMPLATE_FILENAMES", "stats", stats) - - # SERVER - cf.set("SERVER", "root", srv) - cf.set("SERVER", "domain", srv_dom) - - # WIP - cf.set("WIP_DIRS", "root", srv_wip) - cf.set("WIP_DIRS", "images", srv_wip + "images/") - cf.set("WIP_DIRS", "files", srv_wip + "files/") - cf.set("WIP_DIRS", "template", wip_tpl) - cf.set("WIP_FILES", "favicon", wip_favicon) - cf.set("WIP_FILES", "logo", wip_logo) - cf.set("WIP_FILES", "styles", wip_styles) - cf.set("WIP_FILES", "rss", wip_rss) - cf.set("WIP_FILES", "stats", wip_stats) - cf.set("WIP_FILES", "metas", wip_tpl + "metas.html") - cf.set("WIP_FILES", "header", wip_tpl + "header.html") - cf.set("WIP_FILES", "navbar", wip_tpl + "navbar.html") - cf.set("WIP_FILES", "sidebar", wip_tpl + "sidebar.html") - cf.set("WIP_FILES", "footer", wip_tpl + "footer.html") - - - # WWW - cf.set("WWW_DIRS", "root", srv_www) - cf.set("WWW_DIRS", "images", srv_www + "images/") - cf.set("WWW_DIRS", "files", srv_www + "files/") - cf.set("WWW_DIRS", "template", www_tpl) - cf.set("WWW_FILES", "favicon", www_favicon) - cf.set("WWW_FILES", "logo", www_logo) - cf.set("WWW_FILES", "styles", www_styles) - cf.set("WWW_FILES", "rss", www_rss) - cf.set("WWW_FILES", "stats", www_stats) - cf.set("WWW_FILES", "metas", www_tpl + "metas.html") - cf.set("WWW_FILES", "header", www_tpl + "header.html") - cf.set("WWW_FILES", "navbar", www_tpl + "navbar.html") - cf.set("WWW_FILES", "sidebar", www_tpl + "sidebar.html") - cf.set("WWW_FILES", "footer", www_tpl + "footer.html") - - with open(cf_uri, "w") as f: - cf.write(f) + # Write Configuration file + # Only if needed or when new domain + print("domain: write", write) + if write: + with open(cf_uri, "w") as f: + cf.write(f) # Update User local domain configuration file #-------------------------------------------- @@ -377,26 +537,15 @@ def cf_update_values(): def cf_valid(): global active - # Check some values in ult_cf - cf_load() - ult_cf_load() - if not tools.compare_ini_ft(cf_uri, tyto.ini_domain): - return - - # - domain name must be cf_name - try: cf_name = cf.get("DOMAIN", "name") - except: debug.out(100, name, cf_uri, True, 2, True) - if cf_name != name: - cf_update_values() - - try: ult_cf_hash = ult_cf.get("DOMAIN", "hash") - except: cf_update_values() + cf_update_values(False) # Check if cf need to be updated + ult_cf_load() + ult_cf_hash = ult_cf.get("DOMAIN", "hash") now_cf_hash = tools.get_filesum(cf_uri, True) if now_cf_hash != ult_cf_hash: - cf_update_values() + cf_update_values(False) active = is_active() active and create_work_dirs() @@ -456,7 +605,13 @@ except: # cf: Domain Configuration File # #------------------------------------------# # Domain Configuration directory -cf_dir = user_dir.rsplit("articles/")[0] +cf_dir = user_dir.rsplit("articles/")[0] +cf_usr_articles = os.path.join(cf_dir, "articles/") +cf_usr_tpl = os.path.join(cf_dir, "template/") +cf_usr_images = os.path.join(cf_dir, "images/") +cf_usr_files = os.path.join(cf_dir, "files/") +cf_usr_mods = os.path.join(cf_dir, "modules/") +cf_usr_db = os.path.join(cf_dir, ".db/") # Domain name from current basename directory # Exit if not format at least "abc.tld" diff --git a/src/var/lib/tyto/program/forms.py b/src/var/lib/tyto/program/forms.py index 57f10eb..38c2370 100644 --- a/src/var/lib/tyto/program/forms.py +++ b/src/var/lib/tyto/program/forms.py @@ -107,12 +107,6 @@ def ask_domain_title(update): try: title = domain.cf.get("DOMAIN", "title") except: title = "" - """ - if update: - domain.cf_load() - title = domain.cf.get("DOMAIN", "title") - """ - q = "> %s (%s)%s "%(langs.logs.domain_title, shorter(title), langs.logs.q) answer = ask(q, False, title) @@ -130,11 +124,7 @@ def ask_domain_title(update): def ask_domain_date(update): try: date = domain.cf.get("DOMAIN", "date") except: date = "YYYY[-MM-DD]" - """ - if update: - domain.cf_load() - date = domain.cf.get("DOMAIN", "date") - """ + example = date or "YYYY[-MM-DD]" q = "> %s (%s)%s "%(langs.logs.domain_date, example, langs.logs.q) @@ -170,12 +160,6 @@ def ask_domain_date(update): def ask_domain_about(update): try: about = domain.cf.get("DOMAIN", "about") except: about = "" - - """ - if update: - domain.cf_load() - about = domain.cf.get("DOMAIN", "about") - """ q = "> %s (%s)%s "%(langs.logs.domain_about, shorter(about), langs.logs.q) answer = ask(q, False, about) @@ -193,11 +177,6 @@ def ask_domain_about(update): def ask_domain_mail(update): try: mail = domain.cf.get("DOMAIN", "mail") except: mail = "" - """ - if update: - domain.cf_load() - mail = domain.cf.get("DOMAIN", "mail") - """ q = "> %s (%s)%s "%(langs.logs.domain_mail, shorter(mail), langs.logs.q) answer = ask(q, False, mail) @@ -215,11 +194,6 @@ def ask_domain_mail(update): def ask_domain_tags(update): try: tags = domain.cf.get("DOMAIN", "tags") except: tags = "" - """ - if update: - domain.cf_load() - tags = domain.cf.get("DOMAIN", "tags") - """ q = "> %s (%s)%s "%(langs.logs.domain_tags, shorter(tags), langs.logs.q) answer = ask(q, False, tags) @@ -241,15 +215,9 @@ def ask_domain_tags(update): # default en if no translation file # > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! < TODO #-----------------------------------# def ask_domain_lang(update): - try: - lang = domain.cf.get("WEBSITE", "lang") or langs.get_sys_lang() - except: - lang = "" - """ - if update: - domain.cf_load() - lang = domain.cf.get("WEBSITE", "lang") - """ + try: lang = domain.cf.get("WEBSITE", "lang") or langs.get_sys_lang() + except: lang = "" + q = "> %s (%s)%s "%(langs.logs.domain_lang, lang, langs.logs.q) answer = ask(q, False, lang).lower() @@ -278,12 +246,8 @@ def ask_domain_server(update): srv = domain.cf.get("SERVER", "root") if not tools.dir_exists(srv, False): srv = "" - except: srv = "" - """ - if update: - domain.cf_load() - srv = domain.cf.get("SERVER", "root") - """ + except: + srv = "" if srv and not tools.dir_exists(srv, False): srv = "" diff --git a/src/var/lib/tyto/program/post.py b/src/var/lib/tyto/program/post.py index 4ee9948..66310a9 100644 --- a/src/var/lib/tyto/program/post.py +++ b/src/var/lib/tyto/program/post.py @@ -45,17 +45,17 @@ import domain, debug, tools, tyto def is_article(target): # User MUST be in articles/ domain.cf_load() - (os.getcwd() + "/").startswith(domain.articles_dir) or \ - debug.out(2, "-> articles/", domain.articles_dir, True, 2, True) + (os.getcwd() + "/").startswith(domain.cf_usr_articles) or \ + debug.out(2, "-> articles/", domain.cf_usr_articles, True, 2, True) - # Target URI is from legacy directory - if target.startswith("./") or target.startswith("../"): + # Target URI most be from legacy directory or not begins with + if target.startswith(tyto.notarget): debug.out(20, "./, ../", target, True, 2, True) # Article exists global uri - uri = os.path.join(domain.articles_dir, target) + uri = os.path.join(domain.cf_usr_articles, target) os.path.exists(uri) or debug.out(5, "False", uri, True, 2, True) # Article is a Tyto format and not empty (exit on errors) @@ -68,7 +68,7 @@ def is_article(target): uri_id = tools.get_filesum(uri, False) # Set post configuration file database - cf_uri = os.path.join(domain.db_dir, uri_id + ".ini") + cf_uri = os.path.join(domain.cf_usr_db, uri_id + ".ini") # Load Database db = cf_load() # True or False diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index b62a86b..b30d3ea 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -61,7 +61,7 @@ git_url = "https://git.a-lec.org/echolib/tyto-litterateur" #---------------------------# ini_domain = """[DOMAIN] activated = no -name = +name = %s title = date = about = @@ -94,7 +94,7 @@ favicon = favicon.png logo = logo.png styles = styles.css rss = rss.xml -stats = stats.ini +stats = tyto_stats.ini [USER_DIRS] root = @@ -120,9 +120,10 @@ footer = [SERVER] root = /var/www/ domain = +wip = +www = [WIP_DIRS] -root = images = files = template = @@ -140,7 +141,6 @@ sidebar = footer = [WWW_DIRS] -root = images = files = template = @@ -231,6 +231,9 @@ web = lines = """ +# Put here values where posts target cannot begin with +notarget = ("./", "../") + #===================# # Artcicle contents #========================================================== #===================#