-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed #3574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The explanation for this behaviour is that In [1]: import scrapy
...: from scrapy.loader import ItemLoader
...:
...: class MyItem(scrapy.Item):
...: a = scrapy.Field()
...:
...: class MyLoader(ItemLoader):
...: item = MyItem()
...:
...: l1 = MyLoader()
...: l2 = MyLoader()
...: id(l1.item) == id(l2.item)
Out[1]: True I believe what you are looking for is In [4]: import scrapy
...: from scrapy.loader import ItemLoader
...:
...: class MyItem(scrapy.Item):
...: a = scrapy.Field()
...:
...: class MyLoader(ItemLoader):
...: default_item_class = MyItem
...:
...: l1 = MyLoader()
...: l2 = MyLoader()
...: l1.add_value("a", "b")
...: l2.add_value("a", [])
...: print(l1.load_item())
...: print(l2.load_item())
{'a': ['b']}
{} |
@hibpm Do you think the documentation changes proposed at #4099 would have prevented you from redefining |
Closed
The text was updated successfully, but these errors were encountered: