Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

add typecheck of funcs in ExtractorField.__init__

Ismael Carnales65e8be46bca9
diff --git a/scrapy/trunk/scrapy/contrib_exp/newitem/extractors.py b/scrapy/trunk/scrapy/contrib_exp/newitem/extractors.py
index cb9eef586..29e15f025 100644
--- a/scrapy/trunk/scrapy/contrib_exp/newitem/extractors.py
+++ b/scrapy/trunk/scrapy/contrib_exp/newitem/extractors.py
@@ -37,6 +37,10 @@ class ItemExtractor(object):
class ExtractorField(object):
def __init__(self, funcs):
+ if not hasattr(funcs, '__iter__'):
+ raise TypeError(
+ 'You must initialize ExtractorField with a list of callables')
+
self._funcs = []
for func in funcs: