Skip to content

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

removed deprecated ScrapedItem (previously kept for backwards compatibility)

Pablo Hoffman4a2a20489d3d
diff --git a/examples/googledir/googledir/settings.py b/examples/googledir/googledir/settings.py
index b920cd46e..6c4d6ef8a 100644
--- a/examples/googledir/googledir/settings.py
+++ b/examples/googledir/googledir/settings.py
@@ -7,7 +7,7 @@ BOT_VERSION = '1.0'
SPIDER_MODULES = ['googledir.spiders']
NEWSPIDER_MODULE = 'googledir.spiders'
-DEFAULT_ITEM_CLASS = 'scrapy.item.ScrapedItem'
+DEFAULT_ITEM_CLASS = 'scrapy.item.Item'
USER_AGENT = '%s/%s' % (BOT_NAME, BOT_VERSION)
ITEM_PIPELINES = ['googledir.pipelines.FilterWordsPipeline']
diff --git a/scrapy/item.py b/scrapy/item.py
index d34c8ea03..bfa05774a 100644
--- a/scrapy/item.py
+++ b/scrapy/item.py
@@ -83,29 +83,3 @@ class Item(DictItem):
__metaclass__ = ItemMeta
-
-class ScrapedItem(BaseItem):
-
- def __init__(self, data=None):
- """
- A ScrapedItem can be initialised with a dictionary that will be
- squirted directly into the object.
- """
- import warnings
- warnings.warn("scrapy.item.ScrapedItem is deprecated, use scrapy.item.Item instead",
- DeprecationWarning, stacklevel=2)
- if isinstance(data, dict):
- for attr, value in data.iteritems():
- setattr(self, attr, value)
- elif data is not None:
- raise TypeError("Initialize with dict, not %s" % data.__class__.__name__)
-
- def __repr__(self):
- """
- Generate the following format so that items can be deserialized
- easily: ClassName({'attrib': value, ...})
- """
- reprdict = dict(items for items in self.__dict__.iteritems() \
- if not items[0].startswith('_'))
- return "%s(%s)" % (self.__class__.__name__, repr(reprdict))
-
diff --git a/scrapy/tests/test_item.py b/scrapy/tests/test_item.py
index 1728bd544..2f51395bd 100644
--- a/scrapy/tests/test_item.py
+++ b/scrapy/tests/test_item.py
@@ -1,6 +1,6 @@
import unittest
-from scrapy.item import Item, Field, ScrapedItem
+from scrapy.item import Item, Field
class ItemTest(unittest.TestCase):
@@ -127,23 +127,5 @@ class ItemTest(unittest.TestCase):
self.assertEqual(dict(i), {'name': u'John'})
-# NOTE: ScrapedItem is deprecated and will be removed in the next stable
-# release, and so will these tests.
-
-class ScrapedItemTestCase(unittest.TestCase):
-
- def test_item(self):
-
- class MyItem(ScrapedItem):
- pass
-
- item = MyItem()
- self.assertEqual(repr(item), 'MyItem({})')
-
- item = ScrapedItem({'key': 'value'})
- self.assertEqual(item.key, 'value')
-
- self.assertRaises(TypeError, ScrapedItem, 10)
-
if __name__ == "__main__":
unittest.main()