#NEWLINE# @ app . route ( '/profile/<url_slug>/products' , methods = [ 'GET' ] ) #NEWLINE# @ app . route ( '/profile/<url_slug>/products.json' , methods = [ 'GET' ] ) #NEWLINE# def profile_products_get( url_slug ) : #NEWLINE# #INDENT# action = request . args . get ( 'action' , 'refresh' ) #NEWLINE# source = request . args . get ( 'source' , 'webapp' ) #NEWLINE# timer = util . Timer ( ) #NEWLINE# load_times = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# just_stubs = ( request . args . get ( 'stubs' , 'False' ) . lower ( ) in [ '1' , 'true' ] ) #NEWLINE# if just_stubs : #NEWLINE# #INDENT# profile = get_profile_stubs_from_url_slug ( url_slug ) #NEWLINE# if ( not profile ) : #NEWLINE# #INDENT# abort_json ( 404 , 'This profile does not exist.' ) #NEWLINE# #UNINDENT# load_times [ 'profile' ] = timer . elapsed ( ) #NEWLINE# product_list = [ { #NEWLINE# #INDENT# 'tiid' : p . tiid , #NEWLINE# 'genre' : p . genre , #NEWLINE# #UNINDENT# } for p in profile . products_not_removed if ( p . genre not in [ 'account' ] ) ] #NEWLINE# load_times [ 'product_list' ] = timer . since_last_check ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# profile = get_profile_from_id ( url_slug ) #NEWLINE# if ( not profile ) : #NEWLINE# #INDENT# abort_json ( 404 , 'This profile does not exist.' ) #NEWLINE# #UNINDENT# markup = Markup ( url_slug , embed = False ) #NEWLINE# load_times [ 'profile' ] = timer . elapsed ( ) #NEWLINE# product_list = profile . get_products_markup ( markup = markup , show_keys = [ 'biblio' , 'embed_markup' , '_tiid' , 'tiid' , 'markup' , 'countries_str' , 'year' , 'title' , 'awardedness_score' , 'metrics_raw_sum' , 'authors' , 'genre' , 'genre_icon' ] ) #NEWLINE# load_times [ 'product_list' ] = timer . since_last_check ( ) #NEWLINE# #UNINDENT# product_dicts_list = util . todict ( product_list ) #NEWLINE# resp = { #NEWLINE# #INDENT# 'a_load_times' : load_times , #NEWLINE# 'is_refreshing' : profile . is_refreshing , #NEWLINE# 'list' : product_dicts_list , #NEWLINE# #UNINDENT# } #NEWLINE# return json_resp_from_thing ( resp )