From 1aab0bd8fec832b80c17cf9b3b5039988591238c Mon Sep 17 00:00:00 2001 From: Cyrille LOUARN Date: Tue, 3 Oct 2023 17:22:45 +0200 Subject: [PATCH] [1.9.16] - Working on 'check' process and post database --- src/var/lib/tyto/program/check.py | 21 +++++++++++++++++++++ src/var/lib/tyto/program/post.py | 2 ++ 2 files changed, 23 insertions(+) diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index cc1051a..9251f9c 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -305,6 +305,10 @@ def ml_tag_values(ln, tag, stats): post_error = debug.out(51, tyto_value, post.uri, True, 2, False) return False + # Check value2 link for some tags (file, image...) + if tag in post.value2s_uri(): + if not is_value2_file_exists(ln+2, tag) + # Convert values to HTML (put in post database) html_value = '%s'%( value2, css, "%%s", value3, value1 @@ -328,6 +332,23 @@ def ml_tag_values(ln, tag, stats): return True +#================================# +# Check value2 uri for some tags # +#--------------------------------# +def is_value2_file_exists(ln, tag): + # check first char if "@" to check file in generic folders + print("post: value2", ln, value2) + + # Set defaut directory for files in /files + wrk_df = domain.wrk_file + + # Set directory for images in /images + if tag == post.ml_tags[1]: # image: + wrk_df = domain.wrk_images + + return True + + #=====================# # check text contents #======================================================== #=====================# diff --git a/src/var/lib/tyto/program/post.py b/src/var/lib/tyto/program/post.py index 06af557..d03ffd0 100644 --- a/src/var/lib/tyto/program/post.py +++ b/src/var/lib/tyto/program/post.py @@ -179,6 +179,8 @@ ml_marks = { "abbr:" : "::" } +# Markers with uri in value2 +value2s_uri = (ml_tags[1], ml_tags[2], ml_tags[3]) # text_contents # =============