Store current job in bot object

For not having to provide it for each dependend method as param
This commit is contained in:
2018-09-24 20:26:50 +02:00
parent 776950d990
commit e874804591

View File

@@ -203,15 +203,20 @@ class EuroExangeBot( pywikibot.bot.BaseBot ):
@type job: EuroExangeBotJob @type job: EuroExangeBotJob
""" """
# Store reference to current job in Bot obj
self.current_job = job
# Log job # Log job
jogobot.output( "Work on Job {}".format(job.image) ) jogobot.output( "Work on Job {}".format(job.image) )
# Get file page # Get file page
filepage = pywikibot.page.FilePage(pywikibot.Site(), job.image) self.current_job.filepage = pywikibot.page.FilePage(
pywikibot.Site(), job.image)
# Stop if file not jet exists # Stop if file not jet exists
if not filepage.exists(): if not self.current_job.filepage.exists():
jogobot.output( "Work on Job {}".format(job.image), "ERROR" ) jogobot.output( "Work on Job {}".format( self.current_job.image),
"ERROR" )
raise pywikibot.NoPage( filepage ) raise pywikibot.NoPage( filepage )
self.call_gnuplot( job ) self.call_gnuplot( job )