[#744] Ensure domain is not None before building regex

This commit is contained in:
Cameron Lane 2014-06-12 11:42:14 -04:00
parent ad11fc01cb
commit eefa878f98
1 changed files with 1 additions and 1 deletions

View File

@ -49,7 +49,7 @@ class OffsiteMiddleware(object):
allowed_domains = getattr(spider, 'allowed_domains', None)
if not allowed_domains:
return re.compile('') # allow all by default
regex = r'^(.*\.)?(%s)$' % '|'.join(re.escape(d) for d in allowed_domains)
regex = r'^(.*\.)?(%s)$' % '|'.join(re.escape(d) for d in allowed_domains if d is not None)
return re.compile(regex)
def spider_opened(self, spider):