html: in-dev of sidebar fonction

This commit is contained in:
Cyrille L 2022-11-29 10:44:26 +01:00
parent 51389e2e3c
commit 619ca17c10
1 changed files with 18 additions and 5 deletions

View File

@ -61,17 +61,28 @@ 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' + \