#NEWLINE# def feature_groups_query( portal , q , clear_existing = False ) : #NEWLINE# #INDENT# groups = portal . groups ( [ 'owner' , 'id' , 'title' ] , q ) #NEWLINE# if ( not clear_existing ) : #NEWLINE# #INDENT# featured_groups = portal . properties ( ) . get ( 'featuredGroups' ) #NEWLINE# if featured_groups : #NEWLINE# #INDENT# group_ids = [ group [ 'id' ] for group in groups ] #NEWLINE# for featured_group in featured_groups : #NEWLINE# #INDENT# if ( featured_group [ 'id' ] not in group_ids ) : #NEWLINE# #INDENT# groups . append ( featured_group ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# if groups : #NEWLINE# #INDENT# portal . update_property ( 'featuredGroups' , groups )