From cb325ca2840121168dab5d14821476c000c79425 Mon Sep 17 00:00:00 2001 From: Rouven Bauer Date: Thu, 17 Oct 2019 09:45:07 +0200 Subject: [PATCH] Fixing index error when removing cron; fixes #90 credits to sakkada --- django_crontab/crontab.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django_crontab/crontab.py b/django_crontab/crontab.py index af0db39..9a86a3b 100755 --- a/django_crontab/crontab.py +++ b/django_crontab/crontab.py @@ -116,9 +116,9 @@ def show_jobs(self): if job and job[0][4] == self.settings.CRONTAB_COMMENT: # output the job hash and details if the verbose option is specified if self.verbosity >= 1: + job_hash = job[0][2].split('crontab run')[1].split()[0] print(u'%s -> %s' % ( - job[0][2].split()[4], - self.__get_job_by_hash(job[0][2][job[0][2].find('crontab run') + 12:].split()[0]) + job_hash, self.__get_job_by_hash(job_hash) )) def remove_jobs(self): @@ -135,9 +135,9 @@ def remove_jobs(self): self.crontab_lines.remove(line) # output the action if the verbose option is specified if self.verbosity >= 1: + job_hash = job[0][2].split('crontab run')[1].split()[0] print('removing cronjob: (%s) -> %s' % ( - job[0][2].split()[4], - self.__get_job_by_hash(job[0][2][job[0][2].find('crontab run') + 12:].split()[0]) + job_hash, self.__get_job_by_hash(job_hash) )) # noinspection PyBroadException