mirror of https://github.com/scrapy/scrapy.git
url_pattern is now being compiled before entering the loop
This commit is contained in:
parent
454d5e5733
commit
22c68baf99
|
|
@ -53,8 +53,8 @@ class OffsiteMiddleware(object):
|
|||
allowed_domains = getattr(spider, 'allowed_domains', None)
|
||||
if not allowed_domains:
|
||||
return re.compile('') # allow all by default
|
||||
url_pattern = re.compile("^https?://.*$")
|
||||
for domain in allowed_domains:
|
||||
url_pattern = re.compile("^https?://.*$")
|
||||
if url_pattern.match(domain):
|
||||
warnings.warn("allowed_domains accepts only domains, not URLs. Ignoring URL entry %s in allowed_domains." % domain, URLWarning)
|
||||
|
||||
|
|
@ -67,4 +67,4 @@ class OffsiteMiddleware(object):
|
|||
|
||||
|
||||
class URLWarning(Warning):
|
||||
pass
|
||||
pass
|
||||
|
|
|
|||
Loading…
Reference in New Issue