Scrapy, a fast high-level web crawling & scraping framework for Python.
allow to override item class adaptor in constructor
olveyrac73cbdd9b1db
diff --git a/scrapy/trunk/scrapy/item/models.py b/scrapy/trunk/scrapy/item/models.pyindex 3c40182fb..5ddafddc1 100644--- a/scrapy/trunk/scrapy/item/models.py+++ b/scrapy/trunk/scrapy/item/models.py@@ -3,8 +3,15 @@ from scrapy.item.adaptors import AdaptorPipeclass ScrapedItem(object):"""This is the base class for all scraped items.+ 'guid' attribute is required, and is an attribute+ that identifies uniquely the given scraped item."""- adaptors_pipe = AdaptorPipe([])+ adaptors_pipe = AdaptorPipe()++ def __init__(self, adaptors_pipe=None):+ """If an adaptors_pipe is given, overrides class adaptors_pipe"""+ if adaptors_pipe:+ self.adaptors_pipe = adaptors_pipedef attribute(self, attrname, value):value = self.adaptors_pipe.execute(attrname, value)