Skip to content
Permalink
Browse files

Updates documentation on dynamic item classes.

Fixes #398
  • Loading branch information
barraponto authored and nramirezuy committed Jan 20, 2015
1 parent 5fdab02 commit eeb589a4da057fb0f8acc570136237d217adf2f4
Showing with 2 additions and 4 deletions.
  1. +2 −4 docs/topics/practices.rst
@@ -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.
You can’t perform that action at this time.