Browse Source

Store current job in bot object

For not having to provide it for each dependend method as param
develop
Jonathan Golder 4 years ago
parent
commit
e874804591
  1. 11
      euroexange/euroexange.py

11
euroexange/euroexange.py

@ -203,15 +203,20 @@ class EuroExangeBot( pywikibot.bot.BaseBot ):
@type job: EuroExangeBotJob
"""
# Store reference to current job in Bot obj
self.current_job = job
# Log job
jogobot.output( "Work on Job {}".format(job.image) )
# 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
if not filepage.exists():
jogobot.output( "Work on Job {}".format(job.image), "ERROR" )
if not self.current_job.filepage.exists():
jogobot.output( "Work on Job {}".format( self.current_job.image),
"ERROR" )
raise pywikibot.NoPage( filepage )
self.call_gnuplot( job )

Loading…
Cancel
Save