diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index e368929..8777817 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -544,11 +544,13 @@ def check_file_uri(filetype, filename, ln): elif filetype == 'file': fileuri = db.domain_files + filename[1: len(filename)] - elif filename.startswith('/'): - fileuri = tyto.post_dir + filename[1: len(filename)] - 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 if not os.path.exists(fileuri): diff --git a/src/var/lib/tyto/program/publish.py b/src/var/lib/tyto/program/publish.py index af19884..6f80842 100644 --- a/src/var/lib/tyto/program/publish.py +++ b/src/var/lib/tyto/program/publish.py @@ -85,15 +85,8 @@ def publish_article(): shutil.copy2(db.post_wip, db.post_www) logs.out("33", db.post_www, False) + # Copy needed files (Also create sub-folders) 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 tyto.replace_in_db(db.post_db, 'www', db.hash_post) diff --git a/src/var/lib/tyto/program/wip.py b/src/var/lib/tyto/program/wip.py index 4e42dd2..3bd629e 100644 --- a/src/var/lib/tyto/program/wip.py +++ b/src/var/lib/tyto/program/wip.py @@ -142,16 +142,9 @@ def wip_article(target): tyto.set_file(db.post_wip, 'New', html.main_page) logs.out("33", db.post_wip, False) - # Copy needed file to wip + # Copy needed files (Also create sub-folders) 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 # @@ -240,7 +233,7 @@ def wip_links(): # Doing files, first, becase of similar marker if db.uniq_files > 0: for i in range(1, db.uniq_files + 1): - file = 'file_%s'%i + file = 'db.file_%s'%i article_bottom = article_bottom.replace( eval(file)[0]+'+', eval(file)[1]%('_blank') )