entity.py
changeset 5328 c51e8f62652a
parent 5201 2b4267157f85
parent 5320 848e92bb81cc
child 5423 e15abfdcce38
--- a/entity.py	Mon Apr 19 13:51:16 2010 +0200
+++ b/entity.py	Mon Apr 19 13:52:55 2010 +0200
@@ -269,6 +269,14 @@
         return '<Entity %s %s %s at %s>' % (
             self.e_schema, self.eid, self.keys(), id(self))
 
+    def __json_encode__(self):
+        """custom json dumps hook to dump the entity's eid
+        which is not part of dict structure itself
+        """
+        dumpable = dict(self)
+        dumpable['eid'] = self.eid
+        return dumpable
+
     def __nonzero__(self):
         return True