Skip to content

Commit 85b52b0

Browse files
committed
For consistency, use job_dir helper in SpiderState extension.
The `SpiderState` extension is the only place not using the `job_dir` helper. This might cause an error in case JOBDIR is a nested path which does not exists, although this is least likely by default given the job dir being set up earlier.
1 parent 91387b6 commit 85b52b0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scrapy/contrib/spiderstate.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from six.moves import cPickle as pickle
33

44
from scrapy import signals
5+
from scrapy.utils.job import job_dir
56

67
class SpiderState(object):
78
"""Store and load spider state during a scraping job"""
@@ -11,7 +12,7 @@ def __init__(self, jobdir=None):
1112

1213
@classmethod
1314
def from_crawler(cls, crawler):
14-
obj = cls(crawler.settings.get('JOBDIR'))
15+
obj = cls(job_dir(crawler.settings))
1516
crawler.signals.connect(obj.spider_closed, signal=signals.spider_closed)
1617
crawler.signals.connect(obj.spider_opened, signal=signals.spider_opened)
1718
return obj

0 commit comments

Comments
 (0)