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 = \ pass_targets = \
( (
'all', 'updated',
'again', 'again',
'newer', 'newer',
'domain', 'domain',
@ -96,7 +96,7 @@ pass_targets = \
'template' 'template'
) )
multi_chk = ('all', 'again', 'newer') multi_chk = ('updated', 'again', 'newer')
action = '' action = ''
target = '' target = ''

View File

@ -54,9 +54,16 @@ def manage(target):
if not target: if not target:
logs.out("5", '[target]', True) logs.out("5", '[target]', True)
# update, again, newer
elif target in args.multi_chk: elif target in args.multi_chk:
check_all(target) check_all(target)
# modules (sidebar...)
elif target in args.pass_targets:
check_module(target)
return
# Unused file
elif not db.post: elif not db.post:
logs.out("1", db.uri_file, True) logs.out("1", db.uri_file, True)
@ -72,10 +79,33 @@ def manage(target):
else: else:
check_process(target) check_process(target)
# Article is not valid
if post_err and not target in args.multi_chk: if post_err and not target in args.multi_chk:
logs.out("7", db.uri_file, True) 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 # # Argument all #
# check all realdy checkded articles # # check all realdy checkded articles #
@ -116,7 +146,7 @@ def check_all(option):
except: except:
continue continue
if option == 'all' and not db.old_chk: if option == 'updated' and not db.old_chk:
continue continue
found = True found = True

View File

@ -201,6 +201,53 @@ if not hole:
if active: if active:
ready = True 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 # # 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), '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), '51' : '%s%s%s > %s'%(CY, langs.log.data_inc, CS, value),
'60' : '\n%s'%langs.log.status_r, '60' : '\n%s'%langs.log.status_r,
'61' : '%s%s%s > %s'%(CG, langs.log.file_e, CS, value),
'255' : '%s'%langs.log.laterout '255' : '%s'%langs.log.laterout
} }

View File

@ -176,7 +176,7 @@ def manage(target):
tyto.edit_file(file) tyto.edit_file(file)
except: 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 # If edit article and hash changed, ask to check

View File

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

View File

@ -21,6 +21,7 @@ line = "Ligne"
no_up = "not updated" no_up = "not updated"
ntd = "Nothing to do" ntd = "Nothing to do"
all_ok = "All is OK"
unused_r = "Unused ressource" unused_r = "Unused ressource"
unused_c = "Unused database value" unused_c = "Unused database value"
db_inv = "Corrupted article's database" db_inv = "Corrupted article's database"
@ -41,7 +42,7 @@ file_e = "File exists"
dir_c = "Directory created" dir_c = "Directory created"
dir_e = "Directory exists" dir_e = "Directory exists"
was_chk = "Article 'check'" was_chk = "Article 'check'"
was_wip = "Article already 'wip'" was_wip = "Article already 'wip'"
check_m = "Check manually" check_m = "Check manually"
post_inc = "Unused in article" post_inc = "Unused in article"

View File

@ -21,6 +21,7 @@ line = "Line"
no_up = "non mise à jour" no_up = "non mise à jour"
ntd = "Rien à faire" ntd = "Rien à faire"
all_ok = "Tout va bien"
unused_r = "Ressource manquante" unused_r = "Ressource manquante"
unused_c = "Valeur de la base de donnée manquante" unused_c = "Valeur de la base de donnée manquante"
db_inv = "Base de donnée de l'article corrompue" db_inv = "Base de donnée de l'article corrompue"
@ -55,7 +56,7 @@ mark_np = "Marqueurs non jumelés"
symb_np = "Symboles non jumelés" symb_np = "Symboles non jumelés"
snpic_d = "snpic utilisé par défaut. Manquant" snpic_d = "snpic utilisé par défaut. Manquant"
anch_nu = "Ancre non unique" anch_nu = "Ancre non unique"
nyfile = "Fichier pas encore créé" nyfile = "Fichier pas encore créé"
nycheck = "Article pas encore 'check'" nycheck = "Article pas encore 'check'"
nywip = "Article pas encore 'wip'" nywip = "Article pas encore 'wip'"
add = "Ajout:" add = "Ajout:"

View File

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