From 619ca17c10a7016c02f0f5f9be2d1d40a1eaaa82 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Tue, 29 Nov 2022 10:44:26 +0100 Subject: [PATCH] html: in-dev of sidebar fonction --- src/var/lib/tyto/program/sidebar.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/var/lib/tyto/program/sidebar.py b/src/var/lib/tyto/program/sidebar.py index 240b18f..6096e3e 100644 --- a/src/var/lib/tyto/program/sidebar.py +++ b/src/var/lib/tyto/program/sidebar.py @@ -61,18 +61,29 @@ def loop_sidebar(create): elif line.startswith('#'): continue elif len(line) == 0 : continue else: - counter += 1 - if counter == max_items: break + if line.startswith('/'): line = line[1:len(line)] post_uri = '%s%s'%(domain.domain_articles, line) if not os.path.exists(post_uri): - print(':< Unused file: %s'%post_uri) + print(':< From URI: %s. Unused file: %s'%(line, post_uri)) Post_Err = True else: + counter += 1 + if counter == max_items: break hash_post = check.get_filesum(post_uri, False) sdb_posts = sdb_posts + [hash_post] - print(sdb_posts) - + if Post_Err: + msg_log = 'Sidebar > Not created. Mismatch some article\'s URI' + log.append_f(domain.tyto_logs, msg_log, 1) + else: + print(sdb_posts) + for item in sdb_posts: + + if os.path.exists('%s%s.conf'%(domain.domain_db, item)): + print("OK for",item) + else: + print('Err for',item) + #=====================# # Create sidebar file # #---------------------# @@ -84,6 +95,7 @@ def create_sdb_load(): '# Dossier: articles/sidebar/\n' + \ '# (depuis le dossier du domaine)\n' + \ '# Comment: 1 URI de l\'article par ligne\n' + \ + '# Ne commence pas par "/"\n' + \ '# L\'ordre définit la position\n' + \ '# exemples :\n' + \ '# index.tyto\n' + \ @@ -96,6 +108,7 @@ def create_sdb_load(): '# Folder: articles/sidebar/\n' + \ '# (from the domain folder)\n' + \ '# Comment: 1 article URI per line\n' + \ + '# not begining with "/"\n' + \ '# Order in sidebar position\n' + \ '# examples :\n' + \ '# index.tyto\n' + \