added item_to_dict util function

--HG--
extra : convert_revision : svn%3Ab85faa78-f9eb-468e-a121-7cced6da292c%40988
This commit is contained in:
Ismael Carnales 2009-03-16 01:12:57 +00:00
parent f9e5915fd4
commit 63150e2ed4
1 changed files with 8 additions and 0 deletions

View File

@ -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