|
@ -34,7 +34,7 @@ from pywikibot import pagegenerators |
|
|
import jogobot |
|
|
import jogobot |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(*args): |
|
|
def main(*args): # noqa (temp) |
|
|
""" |
|
|
""" |
|
|
Process command line arguments and invoke bot. |
|
|
Process command line arguments and invoke bot. |
|
|
|
|
|
|
|
@ -120,7 +120,7 @@ def main(*args): |
|
|
# It has to threw an exception if something does not work properly |
|
|
# It has to threw an exception if something does not work properly |
|
|
try: |
|
|
try: |
|
|
# Init bot with genFactory and **kwargs |
|
|
# Init bot with genFactory and **kwargs |
|
|
bot = Bot( genFactory, **kwargs ) # noqa (temp) |
|
|
bot = Bot( genFactory, **kwargs ) |
|
|
|
|
|
|
|
|
except: |
|
|
except: |
|
|
# Catch Errors while initiation |
|
|
# Catch Errors while initiation |
|
@ -132,7 +132,44 @@ def main(*args): |
|
|
else: |
|
|
else: |
|
|
# Init successfull |
|
|
# Init successfull |
|
|
jogobot.output( ( |
|
|
jogobot.output( ( |
|
|
"{task_slug}-{subtask} init successfull" ). |
|
|
"Subtask \"{task_slug}-{subtask}\" was" + |
|
|
|
|
|
"initiated successfully" ). |
|
|
|
|
|
format(task_slug=task_slug, subtask=subtask) ) |
|
|
|
|
|
|
|
|
|
|
|
# Fire up Bot |
|
|
|
|
|
# Bot must have implemented a run()-method |
|
|
|
|
|
# It has to threw an exception if something does not work properly |
|
|
|
|
|
try: |
|
|
|
|
|
# Call run method on Bot |
|
|
|
|
|
bot.run() |
|
|
|
|
|
|
|
|
|
|
|
# Special event on AttributeError to catch missing run()-method |
|
|
|
|
|
except AttributeError: |
|
|
|
|
|
(type, value, traceback) = sys.exc_info() |
|
|
|
|
|
|
|
|
|
|
|
# Catch missing run()-method |
|
|
|
|
|
if "has no attribute 'run'" in value: |
|
|
|
|
|
jogobot.output( ( |
|
|
|
|
|
"\03{{red}} Error while trying to run " + |
|
|
|
|
|
"subtask \"{task_slug}-{subtask} \": +" |
|
|
|
|
|
"Run-method is missing! "). |
|
|
|
|
|
format( task_slug=task_slug, subtask=subtask ), "ERROR" ) |
|
|
|
|
|
|
|
|
|
|
|
# Pass through other AttributeError |
|
|
|
|
|
else: |
|
|
|
|
|
raise |
|
|
|
|
|
|
|
|
|
|
|
except: |
|
|
|
|
|
jogobot.output( ( |
|
|
|
|
|
"\03{{red}} Error while trying to run " + |
|
|
|
|
|
"subtask \"{task_slug}-{subtask} \"!" ). |
|
|
|
|
|
format( task_slug=task_slug, subtask=subtask ), "ERROR" ) |
|
|
|
|
|
raise |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
# Run successfull |
|
|
|
|
|
jogobot.output( ( |
|
|
|
|
|
"Subtask \"{task_slug}-{subtask}\" was finished successfully"). |
|
|
format(task_slug=task_slug, subtask=subtask) ) |
|
|
format(task_slug=task_slug, subtask=subtask) ) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|