add arguments check [modules] and template. + Some fixes

This commit is contained in:
Cyrille L 2023-04-06 15:36:51 +02:00
parent ec64ff32ab
commit 2f0b03c656
9 changed files with 90 additions and 10 deletions

View File

@ -84,7 +84,7 @@ pass_db = \
pass_targets = \
(
'all',
'updated',
'again',
'newer',
'domain',
@ -96,7 +96,7 @@ pass_targets = \
'template'
)
multi_chk = ('all', 'again', 'newer')
multi_chk = ('updated', 'again', 'newer')
action = ''
target = ''

View File

@ -54,9 +54,16 @@ def manage(target):
if not target:
logs.out("5", '[target]', True)
# update, again, newer
elif target in args.multi_chk:
check_all(target)
# modules (sidebar...)
elif target in args.pass_targets:
check_module(target)
return
# Unused file
elif not db.post:
logs.out("1", db.uri_file, True)
@ -72,10 +79,33 @@ def manage(target):
else:
check_process(target)
# Article is not valid
if post_err and not target in args.multi_chk:
logs.out("7", db.uri_file, True)
#===============================#
# Argument is a module name #
# Check if modules files exists #
#-------------------------------#
def check_module(target):
if target == "domain":
status.check(target)
return
try:
unused_f = False
logs.out("60", '', False)
for t in dom.modules[target]:
if not os.path.exists(t):
logs.out("24", t, False)
unused_f = True
if not unused_f:
logs.out("28", "%s"%langs.log.all_ok, False)
except:
logs.out("28", "%s + %s"%(args.action, target), True)
#==============================================#
# Argument all #
# check all realdy checkded articles #
@ -116,7 +146,7 @@ def check_all(option):
except:
continue
if option == 'all' and not db.old_chk:
if option == 'updated' and not db.old_chk:
continue
found = True

View File

@ -201,6 +201,53 @@ if not hole:
if active:
ready = True
metas = (
eval(str('metas_f')),
eval(str('wip_metas_f')),
eval(str('www_metas_f'))
)
navbars = (
eval(str('navbar_f')),
eval(str('wip_navbar_f')),
eval(str('www_navbar_f'))
)
sidebars = (
eval(str('sidebar_f')),
eval(str('wip_sidebar_f')),
eval(str('www_sidebar_f'))
)
footers = (
eval(str('footer_f')),
eval(str('wip_footer_f')),
eval(str('www_footer_f')),
eval(str('footer_about_f'))
)
templates = (
eval(str('wip_logo_f')),
eval(str('wip_css_f')),
eval(str('wip_navbar_f')),
eval(str('wip_sidebar_f')),
eval(str('wip_metas_f')),
eval(str('wip_footer_f')),
eval(str('wip_stats_f')),
eval(str('www_logo_f')),
eval(str('www_css_f')),
eval(str('www_navbar_f')),
eval(str('www_sidebar_f')),
eval(str('www_metas_f')),
eval(str('www_footer_f')),
eval(str('www_stats_f')),
eval(str('www_rss_f')),
)
modules = {
"metas" : metas,
"navbar" : navbars,
"sidebar" : sidebars,
"footer" : footers,
"template": templates,
}
#====================================#
# Check if domain is ready and ready #

View File

@ -95,6 +95,7 @@ def out(nbr, value, out):
'46' : '%s%s %s%s > %s'%(CY, langs.log.time_t, langs.log.no_up, CS, value),
'51' : '%s%s%s > %s'%(CY, langs.log.data_inc, CS, value),
'60' : '\n%s'%langs.log.status_r,
'61' : '%s%s%s > %s'%(CG, langs.log.file_e, CS, value),
'255' : '%s'%langs.log.laterout
}

View File

@ -176,7 +176,7 @@ def manage(target):
tyto.edit_file(file)
except:
logs.out("28", '%s + %s'%(action, target), True)
logs.out("28", '%s + %s'%(args.action, target), True)
# If edit article and hash changed, ask to check

View File

@ -55,7 +55,7 @@ def manage(target):
elif target in args.pass_targets:
do = {
'all' : wip_all,
'updated' : wip_all,
'again' : wip_all,
'newer' : wip_all,
'sidebar' : html.create_sidebar,
@ -102,7 +102,7 @@ def wip_all(process):
langs.site.wip_again, langs.site.q
), True)
elif args.target == "all":
elif args.target == "updated":
print('%s'%langs.site.wip_older)
elif args.target == "newer":
@ -138,7 +138,7 @@ def wip_all(process):
continue
# All: only old wip
elif option == "all" and not db.old_wip:
elif option == "updated" and not db.old_wip:
continue
# again: wip again wip articles

View File

@ -21,6 +21,7 @@ line = "Ligne"
no_up = "not updated"
ntd = "Nothing to do"
all_ok = "All is OK"
unused_r = "Unused ressource"
unused_c = "Unused database value"
db_inv = "Corrupted article's database"

View File

@ -21,6 +21,7 @@ line = "Line"
no_up = "non mise à jour"
ntd = "Rien à faire"
all_ok = "Tout va bien"
unused_r = "Ressource manquante"
unused_c = "Valeur de la base de donnée manquante"
db_inv = "Base de donnée de l'article corrompue"

View File

@ -276,7 +276,7 @@ args_helps = """\n# Nouveau domaine :
- [target] > Selon l'action [action]
# Traitement en masse
all : Mise à jour des articles modifiés (déjà vérifiés)
updated : Mise à jour des articles modifiés (déjà vérifiés)
again : Forcer TOUS les articles déjà vérifiés
newer : [check] Vérifier tous les article .tyto dans le domaine
qui n'ont pas été déjà vérifiés