wip: added option 'again' to wip all already wip articles (indev)
This commit is contained in:
parent
173eb7027f
commit
d008f6e78f
|
@ -50,13 +50,14 @@ actions = {
|
||||||
|
|
||||||
# Dict for Options
|
# Dict for Options
|
||||||
options = {
|
options = {
|
||||||
'-a' : 'Add', 'add' : 'Add',
|
'-a' : 'Add', 'add' : 'Add',
|
||||||
'-R' : "Remove", 'remove' : "Remove",
|
'-R' : "Remove", 'remove' : "Remove",
|
||||||
'-n' : "New", 'new' : "New",
|
'-n' : "New", 'new' : "New",
|
||||||
'-e' : "Edit", 'edit' : "Edit",
|
'-e' : "Edit", 'edit' : "Edit",
|
||||||
'-F' : "Force", 'force' : "Force",
|
'-F' : "Force", 'force' : "Force",
|
||||||
'-s' : "Show",
|
'-s' : "Show",
|
||||||
'-d' : 'DB'
|
'-d' : 'DB',
|
||||||
|
'again': 'Again'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Set Argument 2 or 3
|
# Set Argument 2 or 3
|
||||||
|
|
|
@ -28,7 +28,8 @@ arguments = (
|
||||||
'-e', 'edit',
|
'-e', 'edit',
|
||||||
'-n', 'new',
|
'-n', 'new',
|
||||||
'-F', 'force',
|
'-F', 'force',
|
||||||
'-d'
|
'-d',
|
||||||
|
'again'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Settings
|
# Settings
|
||||||
|
|
|
@ -20,6 +20,32 @@ import os, re
|
||||||
import tyto, html
|
import tyto, html
|
||||||
|
|
||||||
def manage_wip(target, option):
|
def manage_wip(target, option):
|
||||||
|
global post_db, hash_post
|
||||||
|
|
||||||
|
#-----------------------------------------
|
||||||
|
# Option 'Again' to wip again, based on DB
|
||||||
|
#-----------------------------------------
|
||||||
|
if option == 'Again':
|
||||||
|
ask = ''
|
||||||
|
ask = input(":? wip again all already converted articles ? ")
|
||||||
|
if not ask in ['y', 'Y']:
|
||||||
|
return
|
||||||
|
|
||||||
|
# Load domain configuration DB
|
||||||
|
exec(open(tyto.domain_conf).read(),globals())
|
||||||
|
for post_db in os.listdir(domain_db):
|
||||||
|
if post_db.endswith('.conf'):
|
||||||
|
# Load DB
|
||||||
|
post_db = '%s%s'%(domain_db, post_db)
|
||||||
|
exec(open(post_db).read(),globals())
|
||||||
|
print("->", root_uri)
|
||||||
|
hash_post = tyto.get_filesum(post_db, True) # From content file
|
||||||
|
wip_article(root_uri)
|
||||||
|
return
|
||||||
|
|
||||||
|
#------------------------
|
||||||
|
# Per article with target
|
||||||
|
#------------------------
|
||||||
# target needed
|
# target needed
|
||||||
if not target: tyto.exiting("5", '', True)
|
if not target: tyto.exiting("5", '', True)
|
||||||
|
|
||||||
|
@ -30,10 +56,12 @@ def manage_wip(target, option):
|
||||||
tyto.exiting("4", '', True)
|
tyto.exiting("4", '', True)
|
||||||
|
|
||||||
# Load DB
|
# Load DB
|
||||||
exec(open(tyto.post_db).read(),globals())
|
post_db = tyto.post_db
|
||||||
|
hash_post = tyto.hash_post
|
||||||
|
exec(open(post_db).read(),globals())
|
||||||
|
|
||||||
# Exit if article has changed
|
# Exit if article has changed
|
||||||
if hash_chk != tyto.hash_post: tyto.exiting("9", '', True)
|
if hash_chk != hash_post: tyto.exiting("9", '', True)
|
||||||
|
|
||||||
# In any case, if Force
|
# In any case, if Force
|
||||||
if option == 'Force':
|
if option == 'Force':
|
||||||
|
@ -91,11 +119,11 @@ def wip_article(target):
|
||||||
print(article_bottom)
|
print(article_bottom)
|
||||||
|
|
||||||
# Get article DB in html.py
|
# Get article DB in html.py
|
||||||
html.set_page(tyto.post_db)
|
html.set_page(post_db)
|
||||||
print(html.main_page)
|
print(html.main_page)
|
||||||
|
|
||||||
# Replace in DB hash_wip and date_wip
|
# Replace in DB hash_wip and date_wip
|
||||||
tyto.replace_in_db(tyto.post_db, 'wip', tyto.hash_post)
|
tyto.replace_in_db(post_db, 'wip', hash_post)
|
||||||
|
|
||||||
|
|
||||||
#=================================#
|
#=================================#
|
||||||
|
|
Loading…
Reference in New Issue