#NEWLINE# def dehydrate_members( self , bundle ) : #NEWLINE# #INDENT# rangesString = bundle . request . GET . get ( 'ranges' , None ) #NEWLINE# fullRange = ( ranges is None ) #NEWLINE# if ( not fullRange ) : #NEWLINE# #INDENT# ranges = map ( ( lambda rangeString : [ ( datetime . strptime ( val , '%Y%m' ) if val else None ) for val in rangeString . split ( '-' ) ] ) , rangesString . split ( ',' ) ) #NEWLINE# mks_values = dict ( bundle . obj . get_mks_values ( ranges ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mks_values = dict ( bundle . obj . get_mks_values ( ) ) #NEWLINE# #UNINDENT# members = [ ] #NEWLINE# for mk in Member . objects . filter ( pk__in = mks_values . keys ( ) , current_party__isnull = False ) . select_related ( 'current_party' ) : #NEWLINE# #INDENT# current_party = mk . current_party #NEWLINE# mk_data = mks_values [ mk . id ] #NEWLINE# members . append ( dict ( id = mk . id , name = mk . name , score = ( map ( itemgetter ( 'score' ) , mk_data ) if ( type ( mk_data ) is not dict ) else mk_data [ 'score' ] ) , rank = ( map ( itemgetter ( 'rank' ) , mk_data ) if ( type ( mk_data ) is not dict ) else mk_data [ 'rank' ] ) , volume = ( map ( itemgetter ( 'volume' ) , mk_data ) if ( type ( mk_data ) is not dict ) else mk_data [ 'volume' ] ) , numvotes = ( map ( itemgetter ( 'numvotes' ) , mk_data ) if ( type ( mk_data ) is not dict ) else mk_data [ 'numvotes' ] ) , numforvotes = ( map ( itemgetter ( 'numforvotes' ) , mk_data ) if ( type ( mk_data ) is not dict ) else mk_data [ 'numforvotes' ] ) , numagainstvotes = ( map ( itemgetter ( 'numagainstvotes' ) , mk_data ) if ( type ( mk_data ) is not dict ) else mk_data [ 'numagainstvotes' ] ) , absolute_url = mk . get_absolute_url ( ) , party = current_party . name , party_url = current_party . get_absolute_url ( ) , party_id = current_party . pk ) ) #NEWLINE# #UNINDENT# return members