parameters: (post_objects, request)
return_statement: return post_objects, paginator, page_objects, page_range, current_page, show_first, show_end
docstring: page public function , return page's object tuple
      分页公用函数，返回分页的对象元组
docstring_summary: page public function , return page's object tuple
      分页公用函数，返回分页的对象元组
docstring_tokens: page public function return page s object tuple 分页公用函数，返回分页的对象元组
function: def pages(post_objects, request):
      """
      page public function , return page's object tuple
      分页公用函数，返回分页的对象元组
      """
      paginator = Paginator(post_objects, 20)
      try:
          current_page = int(request.GET.get('page', '1'))
      except ValueError:
          current_page = 1
  
      page_range = page_list_return(len(paginator.page_range), current_page)
  
      try:
          page_objects = paginator.page(current_page)
      except (EmptyPage, InvalidPage):
          page_objects = paginator.page(paginator.num_pages)
  
      if current_page >= 5:
          show_first = 1
      else:
          show_first = 0
  
      if current_page <= (len(paginator.page_range) - 3):
          show_end = 1
      else:
          show_end = 0
  
      # 所有对象， 分页器， 本页对象， 所有页码， 本页页码，是否显示第一页，是否显示最后一页
      return post_objects, paginator, page_objects, page_range, current_page, show_first, show_end
function_tokens: def pages ( post_objects , request ) : paginator = Paginator ( post_objects , 20 ) try : current_page = int ( request . GET . get ( 'page' , '1' ) ) except ValueError : current_page = 1 page_range = page_list_return ( len ( paginator . page_range ) , current_page ) try : page_objects = paginator . page ( current_page ) except ( EmptyPage , InvalidPage ) : page_objects = paginator . page ( paginator . num_pages ) if current_page >= 5 : show_first = 1 else : show_first = 0 if current_page <= ( len ( paginator . page_range ) - 3 ) : show_end = 1 else : show_end = 0 # 所有对象， 分页器， 本页对象， 所有页码， 本页页码，是否显示第一页，是否显示最后一页 return post_objects , paginator , page_objects , page_range , current_page , show_first , show_end