Skip to content

Commit

Permalink
Updates documentation on dynamic item classes.
Browse files Browse the repository at this point in the history
Fixes #398
  • Loading branch information
barraponto authored and nramirezuy committed Jan 20, 2015
1 parent 5fdab02 commit eeb589a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions docs/topics/practices.rst
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ classes instead of manually coding them.
from scrapy.item import DictItem, Field

def create_item_class(class_name, field_list):
field_dict = {}
for field_name in field_list:
field_dict[field_name] = Field()
fields = {field_name: Field() for field_name in field_list}

return type(class_name, (DictItem,), field_dict)
return type(class_name, (DictItem,), {'fields': fields})

0 comments on commit eeb589a

Please sign in to comment.