def propagate_changes(session):
 from inbox.models.message import Message
 for obj in session.dirty:
  if isinstance(obj, Message):
   obj_state = inspect(obj)
   for attr in obj.propagated_attributes:
    if getattr(obj_state.attrs, attr).history.has_changes():
     if obj.thread:
      obj.thread.dirty = True

def propagate_changes ( session ) : from inbox . models . message import Message for obj in session . dirty : if isinstance ( obj , Message ) : obj_state = inspect ( obj ) for attr in obj . propagated_attributes : if getattr ( obj_state . attrs , attr ) . history . has_changes ( ) : if obj . thread : obj . thread . dirty = True
mark an objects related object as dirty when certain attributes of the object change .