Skip to content

Instantly share code, notes, and snippets.

@marazmiki
Created February 29, 2012 17:19
Show Gist options
  • Save marazmiki/1942625 to your computer and use it in GitHub Desktop.
Save marazmiki/1942625 to your computer and use it in GitHub Desktop.
class FormData(object):
"""
The object with dictionary of data
"""
data = {}
def as_dict(self, fields=None, exclude=None, override={}):
if fields is not None:
return dict([(f, self.data[f]) for f in fields])
elif exclude is not None:
return dict([(f, self.data[f]) for f in self.data if f not in exclude])
elif override:
self.data.update(override)
return self.data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment