entity.py
branchstable
changeset 5320 848e92bb81cc
parent 5199 ebb50479d2ab
child 5328 c51e8f62652a
child 5421 8167de96c523
--- a/entity.py	Fri Apr 16 19:24:53 2010 +0200
+++ b/entity.py	Fri Apr 16 19:45:11 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