job.frequency() throws Exception, when month or weekday are specified in string ranges
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-crontab |
Fix Released
|
High
|
Harun Prasad |
Bug Description
Calling Frequency function on a CronItem throws error when the month or day of the week are specified in string ranges like JAN-MAR or MON-FRI. Below is an example.
>>> from crontab import CronTab
>>> cron = CronTab()
>>> job = cron.new()
>>> job.setall('*/15 15 * * MON-FRI')
True
>>> job.frequency()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/
return self.frequency_
File "/usr/lib/
weekdays = list(self[4])
File "/usr/lib/
for bit in part.range():
File "/usr/lib/
return range(self.vfrom, self.vto+1, self.seq)
TypeError: unsupported operand type(s) for +: 'CronValue' and 'int'
>>>
Attached is the patch for this bug.
Related branches
Changed in python-crontab: | |
status: | Fix Committed → Fix Released |
I've committed r76 which contains a test which show the failure before the fix and that the fix works afterwords.