#NEWLINE# @ frappe . whitelist ( allow_guest = True ) #NEWLINE# def get( doctype , txt = None , limit_start = 0 , **kwargs ) : #NEWLINE# #INDENT# 'Returns processed HTML page for a standard listing.' #NEWLINE# limit_start = cint ( limit_start ) #NEWLINE# limit_page_length = 20 #NEWLINE# next_start = ( limit_start + limit_page_length ) #NEWLINE# if ( ( not txt ) and frappe . form_dict . search ) : #NEWLINE# #INDENT# txt = frappe . form_dict . search #NEWLINE# del frappe . form_dict [ 'search' ] #NEWLINE# #UNINDENT# filters = prepare_filters ( doctype , kwargs ) #NEWLINE# meta = frappe . get_meta ( doctype ) #NEWLINE# list_context = get_list_context ( frappe . _dict ( ) , doctype ) #NEWLINE# if list_context . filters : #NEWLINE# #INDENT# filters . update ( list_context . filters ) #NEWLINE# #UNINDENT# _get_list = ( list_context . get_list or get_list ) #NEWLINE# raw_result = _get_list ( doctype = doctype , txt = txt , filters = filters , limit_start = limit_start , limit_page_length = limit_page_length ) #NEWLINE# if ( not raw_result ) : #NEWLINE# #INDENT# return { #NEWLINE# #INDENT# 'result' : [ ] , #NEWLINE# #UNINDENT# } #NEWLINE# #UNINDENT# show_more = ( ( _get_list ( doctype = doctype , txt = txt , filters = filters , limit_start = next_start , limit_page_length = 1 ) and True ) or False ) #NEWLINE# if txt : #NEWLINE# #INDENT# list_context . default_subtitle = _ ( 'Filtered by "{0}"' ) . format ( txt ) #NEWLINE# #UNINDENT# result = [ ] #NEWLINE# row_template = ( list_context . row_template or 'templates/includes/list/row_template.html' ) #NEWLINE# for doc in raw_result : #NEWLINE# #INDENT# doc . doctype = doctype #NEWLINE# new_context = frappe . _dict ( doc = show_more , meta = meta ) #NEWLINE# new_context . doc = frappe . get_doc ( doc ) #NEWLINE# if ( not frappe . flags . in_test ) : #NEWLINE# #INDENT# new_context [ 'pathname' ] = frappe . local . request . path . strip ( '/ ' ) #NEWLINE# #UNINDENT# new_context . update ( list_context ) #NEWLINE# set_route ( new_context ) #NEWLINE# rendered_row = frappe . render_template ( row_template , new_context , is_path = True ) #NEWLINE# result . append ( rendered_row ) #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# 'result' : result , #NEWLINE# 'show_more' : show_more , #NEWLINE# 'next_start' : next_start , #NEWLINE# #UNINDENT# }