From 6c42144f8927a82aab42267c8bdb049145409b2e Mon Sep 17 00:00:00 2001 From: emijrp Date: Thu, 14 Jul 2011 19:54:14 +0000 Subject: [PATCH] adding --force parameter to skip wiki[mp]edia projects alert git-svn-id: https://wikiteam.googlecode.com/svn/trunk@214 31edc4fc-5e31-b4c4-d58b-c8bc928bcb95 --- dumpgenerator.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dumpgenerator.py b/dumpgenerator.py index e0c6928..bcd5686 100644 --- a/dumpgenerator.py +++ b/dumpgenerator.py @@ -652,10 +652,11 @@ def getParameters(params=[]): other = { 'resume': False, 'filenamelimit': 100, #do not change + 'force': False, } #console params try: - opts, args = getopt.getopt(params, "", ["h", "help", "path=", "api=", "index=", "images", "logs", "xml", "curonly", "resume", "delay=", "namespaces=", "exnamespaces=", ]) + opts, args = getopt.getopt(params, "", ["h", "help", "path=", "api=", "index=", "images", "logs", "xml", "curonly", "resume", "delay=", "namespaces=", "exnamespaces=", "force", ]) except getopt.GetoptError, err: # print help information and exit: print str(err) # will print something like "option -a not recognized" @@ -715,6 +716,8 @@ def getParameters(params=[]): sys.exit() else: config["exnamespaces"] = [int(i) for i in a.split(',')] + elif o in ("--force"): + other["force"] = True else: assert False, "unhandled option" @@ -797,8 +800,10 @@ def main(params=[]): #notice about wikipedia dumps if re.findall(r'(wikipedia|wikisource|wiktionary|wikibooks|wikiversity|wikimedia|wikispecies|wikiquote|wikinews)\.org', config['api']+config['index']): - print 'DO NOT USE THIS SCRIPT TO DOWNLOAD WIKIMEDIA PROJECTS!\nDownload the dumps from http://download.wikimedia.org\nThanks!' - sys.exit() + print 'DO NOT USE THIS SCRIPT TO DOWNLOAD WIKIMEDIA PROJECTS!\nDownload the dumps from http://dumps.wikimedia.org' + if not other['force']: + print '\nThanks!' + sys.exit() print 'Analysing %s' % (config['api'] and config['api'] or config['index'])