entity.py
changeset 5328 c51e8f62652a
parent 5201 2b4267157f85
parent 5320 848e92bb81cc
child 5423 e15abfdcce38
equal deleted inserted replaced
5327:34a298eca917 5328:c51e8f62652a
   266         self._is_saved = True
   266         self._is_saved = True
   267 
   267 
   268     def __repr__(self):
   268     def __repr__(self):
   269         return '<Entity %s %s %s at %s>' % (
   269         return '<Entity %s %s %s at %s>' % (
   270             self.e_schema, self.eid, self.keys(), id(self))
   270             self.e_schema, self.eid, self.keys(), id(self))
       
   271 
       
   272     def __json_encode__(self):
       
   273         """custom json dumps hook to dump the entity's eid
       
   274         which is not part of dict structure itself
       
   275         """
       
   276         dumpable = dict(self)
       
   277         dumpable['eid'] = self.eid
       
   278         return dumpable
   271 
   279 
   272     def __nonzero__(self):
   280     def __nonzero__(self):
   273         return True
   281         return True
   274 
   282 
   275     def __hash__(self):
   283     def __hash__(self):