<s> from reversion_compare . mixins import CompareMixin , CompareMethodsMixin <EOL> from django . template . loader import render_to_string <EOL> class Comparator ( CompareMixin , CompareMethodsMixin ) : <EOL> pass <EOL> class ValueDomainComparator ( Comparator ) : <EOL> """<STR_LIT>""" <EOL> def compare_supplementaryvalue_set ( self , obj_compare ) : <EOL> return self . compare_value_set ( obj_compare ) <EOL> def compare_permissiblevalue_set ( self , obj_compare ) : <EOL> return self . compare_value_set ( obj_compare ) <EOL> def compare_value_set ( self , obj_compare ) : <EOL> change_info = obj_compare . get_m2o_change_info ( ) <EOL> same_meanings_added = [ ] <EOL> same_meanings_removed = [ ] <EOL> same_items_added = [ ] <EOL> same_items_removed = [ ] <EOL> removed_items = change_info [ '<STR_LIT>' ] <EOL> added_items = change_info [ '<STR_LIT>' ] <EOL> for removed in removed_items : <EOL> for added in added_items : <EOL> if ( <EOL> removed . object . meaning == added . object . meaning and <EOL> removed . object . value == added . object . value <EOL> ) : <EOL> same_items_added . append ( added ) <EOL> same_items_removed . append ( removed ) <EOL> elif ( removed . object . meaning == added . object . meaning ) : <EOL> if added not in same_meanings_added and removed not in same_meanings_removed : <EOL> same_meanings_added . append ( added ) <EOL> same_meanings_removed . append ( removed ) <EOL> for same in same_meanings_removed + same_items_removed : <EOL> if same in removed_items : <EOL> removed_items . remove ( same ) <EOL> for same in same_meanings_added + same_items_added : <EOL> added_items . remove ( same ) <EOL> change_info . update ( { <EOL> '<STR_LIT>' : removed_items , <EOL> '<STR_LIT>' : added_items , <EOL> '<STR_LIT>' : change_info [ '<STR_LIT>' ] + same_items_added , <EOL> '<STR_LIT>' : zip ( same_meanings_added , same_meanings_removed ) <EOL> } ) <EOL> context = { "<STR_LIT>" : change_info } <EOL> return render_to_string ( "<STR_LIT>" , context ) </s>
