restored support for spider.DOWNLOAD_DELAY attribute, with deprecation warning

This commit is contained in:
Pablo Hoffman 2011-09-04 08:39:57 -03:00
parent c8d30c6ffa
commit e0ec239930
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,10 @@ class Slot(object):
def _get_concurrency_delay(concurrency, spider, settings):
delay = settings.getfloat('DOWNLOAD_DELAY')
if hasattr(spider, 'DOWNLOAD_DELAY'):
warnings.warn("%s.DOWNLOAD_DELAY attribute is deprecated, use %s.download_delay instead" %
(type(spider).__name__, type(spider).__name__))
delay = spider.DOWNLOAD_DELAY
if hasattr(spider, 'download_delay'):
delay = spider.download_delay