Created
February 29, 2012 17:19
-
-
Save marazmiki/1942625 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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