#NEWLINE# @ property #NEWLINE# def drilldown_map( self ) : #NEWLINE# #INDENT# hierarchy = helper = [ ] #NEWLINE# hierarchy_config = sorted ( [ k for k in LOCATION_HIERARCHY . keys ( ) ] ) #NEWLINE# data = LocationSqlData ( self . request . domain ) . get_data ( ) #NEWLINE# for val in data : #NEWLINE# #INDENT# for lvl in hierarchy_config : #NEWLINE# #INDENT# tmp = dict ( val = val [ lvl ] , text = val [ lvl ] , next = [ ] ) #NEWLINE# tmp_next = [ ] #NEWLINE# exist = False #NEWLINE# for item in hierarchy : #NEWLINE# #INDENT# if ( item [ 'val' ] == val [ lvl ] ) : #NEWLINE# #INDENT# exist = True #NEWLINE# tmp_next = item [ 'next' ] #NEWLINE# break #NEWLINE# #UNINDENT# #UNINDENT# if ( not exist ) : #NEWLINE# #INDENT# if ( not tmp_next ) : #NEWLINE# #INDENT# hierarchy . append ( dict ( val = 0 , text = 'All' , next = [ ] ) ) #NEWLINE# #UNINDENT# hierarchy . append ( tmp ) #NEWLINE# hierarchy = tmp [ 'next' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hierarchy = tmp_next #NEWLINE# #UNINDENT# #UNINDENT# hierarchy = helper #NEWLINE# #UNINDENT# return hierarchy