mirror of https://github.com/scrapy/scrapy.git
added item_to_dict util function
--HG-- extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40988
This commit is contained in:
parent
f9e5915fd4
commit
63150e2ed4
|
|
@ -198,3 +198,11 @@ def string_camelcase(string):
|
|||
"""
|
||||
return CAMELCASE_INVALID_CHARS.sub('', string.title())
|
||||
|
||||
|
||||
def item_to_dict(item):
|
||||
"""Returns a dict representation of an item"""
|
||||
res = {}
|
||||
for field in item.fields:
|
||||
res[field] = getattr(item, field)
|
||||
|
||||
return res
|
||||
|
|
|
|||
Loading…
Reference in New Issue