def update_comment_in_doc(doc):
 if (doc.communication_type not in (u'Comment', u'Communication')):
  return
 if ((doc.communication_type == u'Comment') and (doc.comment_type != u'Comment')):
  return
 def get_content(doc):
  return ((doc.content[:97] + u'...') if (len(doc.content) > 100) else doc.content)
 if (doc.reference_doctype and doc.reference_name and doc.content):
  _comments = get_comments_from_parent(doc)
  updated = False
  for c in _comments:
   if (c.get(u'name') == doc.name):
    c[u'comment'] = get_content(doc)
    updated = True
  if (not updated):
   _comments.append({u'comment': get_content(doc), u'by': (doc.sender or doc.owner), u'name': doc.name})
  update_comments_in_parent(doc.reference_doctype, doc.reference_name, _comments)

def update_comment_in_doc ( doc ) : if ( doc . communication_type not in ( u'Comment' , u'Communication' ) ) : return if ( ( doc . communication_type == u'Comment' ) and ( doc . comment_type != u'Comment' ) ) : return def get_content ( doc ) : return ( ( doc . content [ : 97 ] + u'...' ) if ( len ( doc . content ) > 100 ) else doc . content ) if ( doc . reference_doctype and doc . reference_name and doc . content ) : _comments = get_comments_from_parent ( doc ) updated = False for c in _comments : if ( c . get ( u'name' ) == doc . name ) : c [ u'comment' ] = get_content ( doc ) updated = True if ( not updated ) : _comments . append ( { u'comment' : get_content ( doc ) , u'by' : ( doc . sender or doc . owner ) , u'name' : doc . name } ) update_comments_in_parent ( doc . reference_doctype , doc . reference_name , _comments )
updates _comments property in parent document .