summaryrefslogtreecommitdiff
path: root/models/base.py
diff options
context:
space:
mode:
Diffstat (limited to 'models/base.py')
-rw-r--r--models/base.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/models/base.py b/models/base.py
index fd40001..8a6fc47 100644
--- a/models/base.py
+++ b/models/base.py
@@ -1,10 +1,15 @@
-class BaseModel():
+"""Implements a base model for other models to inherit."""
+from six import iteritems
+
+class BaseModel(object):
+ """BaseModel is meant to be inherited by other models."""
def as_dict(self):
+ """Exposes all the object's values as a dict."""
this_dict = {}
- for k in self.__dict__.keys():
- if k != "_db":
- this_dict[k] = getattr(self, k)
+ for key, val in iteritems(self.__dict__):
+ if key != "_db":
+ this_dict[key] = val
return this_dict