#NEWLINE# def obj_equal_prims( obj_1 , obj_2 , ignore = None ) : #NEWLINE# #INDENT# 'Compare two primitives for equivalence ignoring some keys.\n\n    This operation tests the primitives of two objects for equivalence.\n    Object primitives may contain a list identifying fields that have been\n    changed - this is ignored in the comparison. The ignore parameter lists\n    any other keys to be ignored.\n\n    :param:obj1: The first object in the comparison\n    :param:obj2: The second object in the comparison\n    :param:ignore: A list of fields to ignore\n    :returns: True if the primitives are equal ignoring changes\n    and specified fields, otherwise False.\n    ' #NEWLINE# def _strip( prim , keys ) : #NEWLINE# #INDENT# if isinstance ( prim , dict ) : #NEWLINE# #INDENT# for k in keys : #NEWLINE# #INDENT# prim . pop ( k , None ) #NEWLINE# #UNINDENT# for v in prim . values ( ) : #NEWLINE# #INDENT# _strip ( v , keys ) #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( prim , list ) : #NEWLINE# #INDENT# for v in prim : #NEWLINE# #INDENT# _strip ( v , keys ) #NEWLINE# #UNINDENT# #UNINDENT# return prim #NEWLINE# #UNINDENT# if ( ignore is not None ) : #NEWLINE# #INDENT# keys = ( [ 'nova_object.changes' ] + ignore ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# keys = [ 'nova_object.changes' ] #NEWLINE# #UNINDENT# prim_1 = _strip ( obj_1 . obj_to_primitive ( ) , keys ) #NEWLINE# prim_2 = _strip ( obj_2 . obj_to_primitive ( ) , keys ) #NEWLINE# return ( prim_1 == prim_2 )