some fixes. sub-folders #2

This commit is contained in:
Cyrille L 2023-03-07 11:30:35 +01:00
parent 94f03fed2f
commit 616fed7a8e
3 changed files with 10 additions and 22 deletions

View File

@ -544,11 +544,13 @@ def check_file_uri(filetype, filename, ln):
elif filetype == 'file': elif filetype == 'file':
fileuri = db.domain_files + filename[1: len(filename)] fileuri = db.domain_files + filename[1: len(filename)]
elif filename.startswith('/'):
fileuri = tyto.post_dir + filename[1: len(filename)]
else: else:
fileuri = tyto.post_dir + filename post_dir = db.uri_file.split("/")[-1]
post_dir = db.uri_file.rsplit(post_dir)[0]
if filename.startswith('/'):
fileuri = post_dir + filename[1: len(filename)]
else:
fileuri = post_dir + filename
# Check if file exists # Check if file exists
if not os.path.exists(fileuri): if not os.path.exists(fileuri):

View File

@ -85,15 +85,8 @@ def publish_article():
shutil.copy2(db.post_wip, db.post_www) shutil.copy2(db.post_wip, db.post_www)
logs.out("33", db.post_www, False) logs.out("33", db.post_www, False)
# Copy needed files (Also create sub-folders)
tyto.files_to_srv('www') tyto.files_to_srv('www')
'''
# Copy files registred in article
for uri in db.uris:
f_src = '%s%s'%(db.srv_wip, uri)
f_www = '%s%s'%(db.srv_www, uri)
shutil.copy2(f_src, f_www)
logs.out("33", f_www, False)
'''
# Replace in DB hash_wip and date_wip # Replace in DB hash_wip and date_wip
tyto.replace_in_db(db.post_db, 'www', db.hash_post) tyto.replace_in_db(db.post_db, 'www', db.hash_post)

View File

@ -142,16 +142,9 @@ def wip_article(target):
tyto.set_file(db.post_wip, 'New', html.main_page) tyto.set_file(db.post_wip, 'New', html.main_page)
logs.out("33", db.post_wip, False) logs.out("33", db.post_wip, False)
# Copy needed file to wip # Copy needed files (Also create sub-folders)
tyto.files_to_srv('wip') tyto.files_to_srv('wip')
'''
# Copy needed file to wip
for uri in db.uris:
f_src = '%s%s'%(db.domain_articles, uri)
f_wip = '%s%s'%(db.srv_wip, uri)
shutil.copy2(f_src, f_wip)
logs.out("33", f_wip, False)
'''
#=================================# #=================================#
# Create string article from file # # Create string article from file #
@ -240,7 +233,7 @@ def wip_links():
# Doing files, first, becase of similar marker # Doing files, first, becase of similar marker
if db.uniq_files > 0: if db.uniq_files > 0:
for i in range(1, db.uniq_files + 1): for i in range(1, db.uniq_files + 1):
file = 'file_%s'%i file = 'db.file_%s'%i
article_bottom = article_bottom.replace( article_bottom = article_bottom.replace(
eval(file)[0]+'+', eval(file)[1]%('_blank') eval(file)[0]+'+', eval(file)[1]%('_blank')
) )