app/soc/models/base.py
changeset 977 d212d5f4c41a
parent 751 16dffe0b6336
child 1032 ed83d42d1ed7
--- a/app/soc/models/base.py	Sun Jan 25 11:31:40 2009 +0000
+++ b/app/soc/models/base.py	Sun Jan 25 11:44:25 2009 +0000
@@ -47,7 +47,21 @@
   """
 
   _fields_cache = None
-  
+
+  def toDict(self):
+    """Returns a dict with all StringProperty values of this entity
+    """
+
+    result = {}
+
+    for key, value in self.properties().iteritems():
+      # Skip everything but StringProperties
+      if not isinstance(value, db.StringProperty):
+        continue
+      result[key] = getattr(self, key)
+
+    return result
+
   @classmethod
   def fields(cls):
     """Called by the Django template engine during template instantiation.