From fe88aad27d97c9e4a150469033732d6439a79b4a Mon Sep 17 00:00:00 2001 From: Pablo Hoffman Date: Wed, 2 Dec 2009 23:30:00 -0200 Subject: [PATCH] removed some old code from scrapy.spider.models --- scrapy/spider/models.py | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/scrapy/spider/models.py b/scrapy/spider/models.py index 9210464a3..a9b64995e 100644 --- a/scrapy/spider/models.py +++ b/scrapy/spider/models.py @@ -14,32 +14,14 @@ from scrapy.utils.trackref import object_ref def _valid_domain_name(obj): """Check the domain name specified is valid""" if not obj.domain_name: - raise ValueError("A site domain name is required") - -def _valid_download_delay(obj): - """Check the download delay is valid, if specified""" - delay = getattr(obj, 'download_delay', 0) - if not type(delay) in (int, long, float): - raise ValueError("download_delay must be numeric") - if float(delay) < 0.0: - raise ValueError("download_delay must be positive") + raise ValueError("Spider 'domain_name' attribute is required") class ISpider(Interface, IPlugin) : """Interface to be implemented by site-specific web spiders""" - domain_name = Attribute( - """The domain name of the site to be scraped.""") - - download_delay = Attribute( - """Optional delay in seconds to wait between web page downloads. - Note that this delay does not apply to image downloads. - A delay of less than a second can be specified.""") - - user_agent = Attribute( - """Optional User-Agent to use for this domain""") + domain_name = Attribute("The domain name of the site to be scraped.") invariant(_valid_domain_name) - invariant(_valid_download_delay) class BaseSpider(object_ref): """Base class for scrapy spiders. All spiders must inherit from this