Commit 04c86515 authored by Linedwell's avatar Linedwell

added a force option

parent b5172990
Pipeline #43978738 passed with stage
in 48 seconds
......@@ -8,7 +8,7 @@
# Distributed under the terms of the GNU GPLv3 license
import sys
import sys, getopt
sys.path.insert(1, '..') #ajoute au PYTHONPATH le répertoire parent
import mylogging
......@@ -35,15 +35,16 @@ dicoIT = {
#Recharge le bac à sable avec un contenu prédéfini
def clean(dico):
def clean(dico, force=False):
site = dico['site']
page = pywikibot.Page(site,dico['page'])
template = dico['template']
summary = dico['summary']
delay = dico['delay']
site.login() # force login for below check
if not page.userName() == site.user():
limite = calcLimit(delay)
if page.editTime() < limite:
if (page.editTime() < limite) or force:
page.text = template
......@@ -56,8 +57,19 @@ def calcLimit(delay):
def main():
clean(dicoFR) #nettoyage fr
clean(dicoIT) #nettoyage it
force = False
opts, args = getopt.getopt(sys.argv[1:], 'f', ['force'])
except getopt.GetoptError:
for opt, arg in opts:
if opt in ('-f', '--force'):
force = True
clean(dicoFR, force) #nettoyage fr
clean(dicoIT, force) #nettoyage it
if __name__ == "__main__":
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment