misc changes and fixes
This commit is contained in:
parent
a7397a09e0
commit
a1154029d1
|
@ -53,16 +53,11 @@ domain_values = \
|
|||
'domain_files',
|
||||
'domain_images',
|
||||
'articles_db',
|
||||
'html_db',
|
||||
'navbars_dir',
|
||||
'navbar_load',
|
||||
'navbar_load_db',
|
||||
'sidebar_load',
|
||||
'sidebar_load_db',
|
||||
'metas_load',
|
||||
'metas_load_db',
|
||||
'footer_load',
|
||||
'footer_load_db',
|
||||
'domain_short',
|
||||
'domain_www_url',
|
||||
'domain_wip_url',
|
||||
|
|
|
@ -139,16 +139,11 @@ def create_domain(target):
|
|||
'domain_files = "%sarticles/files/"\n'%db.conf_dir + \
|
||||
'domain_images = "%sarticles/images/"\n'%db.conf_dir + \
|
||||
'articles_db = "%sarticles/"\n'%db_dir + \
|
||||
'html_db = "%s"\n'%db_dir_html + \
|
||||
'navbars_dir = "%s"\n'%navbars_conf + \
|
||||
'navbar_load = "%styto.navbar"\n'%navbars_conf + \
|
||||
'navbar_load_db = "%snavbar_load.conf"\n'%db_dir_html + \
|
||||
'sidebar_load = "%styto.sidebar"\n'%navbars_conf + \
|
||||
'sidebar_load_db = "%ssidebar_load.conf"\n'%db_dir_html + \
|
||||
'metas_load = "%styto.metas.html"\n'%navbars_conf + \
|
||||
'metas_load_db = "%smetas_load.conf"\n'%db_dir_html + \
|
||||
'footer_load = "%styto.footer.html"\n'%navbars_conf + \
|
||||
'footer_load_db = "%sfooter_load.conf"\n'%db_dir_html + \
|
||||
'\ndomain_short = "%s"\n'%domain_short + \
|
||||
'domain_www_url = "%s"\n'%domain_www_url + \
|
||||
'domain_wip_url = "%s"\n'%domain_wip_url
|
||||
|
@ -549,7 +544,6 @@ def create_domain(target):
|
|||
set_f = '\n# Custom HTML (ONE Line)\n' + \
|
||||
"domain_footer_about = '%s'"%domain_footer_about
|
||||
except:
|
||||
domain_about = db.domain_about
|
||||
set_f = '\n# Custom HTML (ONE Line)\n' + \
|
||||
"domain_footer_about = '<p>%s</p>'"%domain_about
|
||||
|
||||
|
@ -593,7 +587,7 @@ def create_domain(target):
|
|||
db.srv_wip_tpl, db.srv_wip_images, db.srv_wip_files,
|
||||
db.srv_www_tpl, db.srv_www_images, db.srv_www_files,
|
||||
db.domain_files, db.domain_images, db.navbars_dir,
|
||||
db.articles_db, db.html_db
|
||||
db.articles_db
|
||||
)
|
||||
|
||||
print(' │')
|
||||
|
@ -689,7 +683,6 @@ def create_sidebar(option):
|
|||
elif tyto.n == 1: sdb_load = sdb_load_en
|
||||
|
||||
tyto.set_file(db.sidebar_load, 'new', sdb_load)
|
||||
tyto.create_db_load(db.sidebar_load, db.sidebar_load_db)
|
||||
logs.out("33", db.sidebar_load, False)
|
||||
|
||||
|
||||
|
@ -766,7 +759,6 @@ def create_navbar(option):
|
|||
elif tyto.n == 1: nvb_load = nav_load_en
|
||||
|
||||
tyto.set_file(db.navbar_load, 'new', nvb_load)
|
||||
tyto.create_db_load(db.navbar_load, db.navbar_load_db)
|
||||
logs.out("33", db.navbar_load, False)
|
||||
|
||||
|
||||
|
@ -840,7 +832,6 @@ def create_metas(option):
|
|||
if not res in ['y', 'Y']: return
|
||||
|
||||
tyto.set_file(db.metas_load, 'new', metas_tags)
|
||||
tyto.create_db_load(db.metas_load, db.metas_load_db)
|
||||
logs.out("33", db.metas_load, False)
|
||||
|
||||
|
||||
|
@ -989,7 +980,6 @@ def create_footer(option):
|
|||
'</footer>'
|
||||
|
||||
tyto.set_file(db.footer_load, 'new', footer)
|
||||
tyto.create_db_load(db.footer_load, db.footer_load_db)
|
||||
logs.out("33", db.footer_load, False)
|
||||
|
||||
# Generic HTML list in footer
|
||||
|
|
|
@ -180,23 +180,23 @@ def create_html_infos_section(process):
|
|||
date_pub = date_new[2] + '/' + date_new[1] + '/' + date_new[0]
|
||||
|
||||
# in <article> > section info : line with new date
|
||||
post_pub = '%s<p>'%(8 * ' ') + \
|
||||
'<span id="article_title" title="%s">Article</span> '%(
|
||||
title
|
||||
) + \
|
||||
'<span title="%s %s">%s</span> '%(
|
||||
tyto.trans[10][tyto.n], date[0], tyto.trans[7][tyto.n]
|
||||
) + \
|
||||
'<span id="article_author">%s</span>. %s '%(
|
||||
author, tyto.trans[8][tyto.n]
|
||||
) + \
|
||||
'<time datetime="%s">'%date_raw + \
|
||||
'<span id="article_date">%s</span> %s '%(
|
||||
date_pub, tyto.trans[9][tyto.n]
|
||||
) + \
|
||||
'<span id="article_time">%s</span>'%time_pub + \
|
||||
'</time>' + \
|
||||
'</p>'
|
||||
post_pub = \
|
||||
'%s<p>'%(8 * ' ') + \
|
||||
'<span id="article_title" title="%s">Article</span> '%(title) + \
|
||||
'<span title="%s %s">%s</span> '%(tyto.trans[10][tyto.n],
|
||||
date[0],
|
||||
tyto.trans[7][tyto.n]
|
||||
) + \
|
||||
'<span id="article_author">%s</span>. %s '%(author,
|
||||
tyto.trans[8][tyto.n]
|
||||
) + \
|
||||
'<time datetime="%s">'%date_raw + \
|
||||
'<span id="article_date">%s</span> %s '%(date_pub,
|
||||
tyto.trans[9][tyto.n]
|
||||
) + \
|
||||
'<span id="article_time">%s</span>'%time_pub + \
|
||||
'</time>' + \
|
||||
'</p>'
|
||||
|
||||
# meta search_date=
|
||||
meta_pub = ' <meta name="search_date" content="%s" />\n'%(
|
||||
|
@ -498,7 +498,6 @@ def create_user_metas(option):
|
|||
logs.out("255", '', True)
|
||||
|
||||
user_file = open(db.metas_load, 'r').read()
|
||||
|
||||
for line in user_file.rsplit('\n'):
|
||||
if line.startswith(metas_used):
|
||||
if user_metas: user_metas = "%s\n %s"%(user_metas, line)
|
||||
|
|
|
@ -71,5 +71,4 @@ def out(nbr, value, out):
|
|||
msg = logs[nbr]
|
||||
print(msg)
|
||||
|
||||
if int(nbr) >= 20: nbr = 0
|
||||
if out: sys.exit(int(nbr))
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
import os, sys, shutil, importlib
|
||||
import logs, args, db, html, tyto, domain, stats, rss
|
||||
|
||||
|
||||
#==============================#
|
||||
# Manage action, get post db #
|
||||
# check if publish can be done #
|
||||
|
@ -46,36 +45,17 @@ def manage_publish(target):
|
|||
do[target]('www')
|
||||
return
|
||||
|
||||
|
||||
# Publish in www server an article
|
||||
#---------------------------------
|
||||
err_pub = False # Default (error to publish)
|
||||
# Database must exists...
|
||||
if not db.db_exists:
|
||||
logs.out("25", db.uri_file, True)
|
||||
|
||||
# Checking if article can be publish
|
||||
if not db.hash_chk:
|
||||
logs.out("25", db.uri_file, False)
|
||||
err_pub = True
|
||||
elif not db.hash_wip:
|
||||
logs.out("30", db.uri_file, False)
|
||||
err_pub = True
|
||||
|
||||
if db.hash_wip:
|
||||
# wip and current article have different hash
|
||||
if db.hash_post != db.hash_chk:
|
||||
logs.out("9", db.uri_file, False)
|
||||
err_pub = True
|
||||
elif db.hash_wip != db.hash_chk:
|
||||
logs.out("30", db.uri_file, False)
|
||||
err_pub = True
|
||||
|
||||
if not os.path.exists(db.post_wip):
|
||||
logs.out("1", db.post_wip, True)
|
||||
|
||||
if err_pub: sys.exit(1)
|
||||
|
||||
# Publish in www server an article
|
||||
check_to_publish('one')
|
||||
publish_article()
|
||||
|
||||
# Create new ATOM/RSS file
|
||||
rss.create_feed()
|
||||
|
||||
|
||||
#===============#
|
||||
|
@ -96,9 +76,6 @@ def publish_article():
|
|||
# Replace publish HTML line
|
||||
replace_line_pub()
|
||||
|
||||
# Create new ATOM/RSS file
|
||||
rss.create_feed()
|
||||
|
||||
|
||||
#=================================================#
|
||||
# Replace line in article containing publish date #
|
||||
|
@ -207,20 +184,45 @@ def create_all(option):
|
|||
print(':> [%s] | %s'%(db.title, db.post_src))
|
||||
hash_post = tyto.get_filesum(db.post_src, True) # From content file
|
||||
|
||||
if not db.hash_chk:
|
||||
logs.out("25", db.uri_file, False)
|
||||
continue
|
||||
check_to_publish('all')
|
||||
if err_pub: continue
|
||||
|
||||
if db.hash_chk != db.hash_post:
|
||||
logs.out("9", db.uri_file, False)
|
||||
continue
|
||||
|
||||
if db.hash_wip != db.hash_chk:
|
||||
logs.out("30", db.uri_file, False)
|
||||
continue
|
||||
|
||||
published = True
|
||||
publish_article()
|
||||
|
||||
if not published:
|
||||
logs.out("28", '(publish)', True)
|
||||
else:
|
||||
# Create new ATOM/RSS file
|
||||
rss.create_feed()
|
||||
|
||||
|
||||
#==============================#
|
||||
# Check if it can be published #
|
||||
#------------------------------#
|
||||
def check_to_publish(process):
|
||||
global err_pub
|
||||
err_pub = False
|
||||
|
||||
# Article must exists in wip server
|
||||
if not os.path.exists(db.post_wip):
|
||||
logs.out("1", db.post_wip, True)
|
||||
|
||||
# Checking if article can be publish
|
||||
if not db.hash_chk:
|
||||
logs.out("25", db.uri_file, False)
|
||||
err_pub = 25
|
||||
elif not db.hash_wip:
|
||||
logs.out("30", db.uri_file, False)
|
||||
err_pub = 30
|
||||
elif db.hash_post != db.hash_chk:
|
||||
logs.out("9", db.uri_file, False)
|
||||
err_pub = 9
|
||||
elif db.hash_wip != db.hash_chk:
|
||||
logs.out("30", db.uri_file, False)
|
||||
err_pub = 30
|
||||
|
||||
if err_pub:
|
||||
if process == 'all': return
|
||||
elif process == 'one': sys.exit(err_pub)
|
||||
|
||||
|
|
|
@ -214,24 +214,6 @@ def set_file(path, new, text):
|
|||
logs.out("4", path, True)
|
||||
|
||||
|
||||
#========================================================#
|
||||
# Create DB file with hash from [type]_load file content #
|
||||
#--------------------------------------------------------#
|
||||
def create_db_load(file_load, file_db):
|
||||
hash_load = get_filesum(file_load, True)
|
||||
if not os.path.exists(file_db):
|
||||
line = 'file_load_hash = "%s"'%hash_load
|
||||
set_file(file_db, True, line)
|
||||
return
|
||||
|
||||
global file_load_hash
|
||||
file_load_hash = ''
|
||||
exec(open(file_db, 'r').read(), globals())
|
||||
if not file_load_hash == hash_load:
|
||||
line = 'file_load_hash = "%s"'%hash_load
|
||||
set_file(file_db, True, line)
|
||||
|
||||
|
||||
#==========================#
|
||||
# Get CSS from line if set #
|
||||
#--------------------------#
|
||||
|
|
Loading…
Reference in New Issue