def showList(request, category=None, tag=None):
  p = int(request.GET.get('p', 0))
  itemsPerPage = Config.POSTS_PER_PAGE
  xml_tree = ET.parse(util.checkBaseline())
  wp_tree = wp.loadXML()
  c = getDefaultContext(request)
  filter = isVisible
  if category:
    filter = lambda d: category in d['categories'] and isVisible(d)
  if tag:
    filter = lambda d: tag in d['tags'] and isVisible(d)
  all_posts = getItems(xml_tree, 'posts', filter) + \
    wp.getItems(wp_tree, 'posts', filter)
  posts = all_posts[p*itemsPerPage:(p+1)*itemsPerPage]
  c['prev'] = -1 if p == 0 else p-1
  c['next'] = -1 if p >= len(all_posts)/itemsPerPage else p+1
  if len(posts) > 0:
    for p in posts:
      p['content'] = loadContent(p)
    assembleContext(c, xml_tree, wp_tree)
    c['posts'] = posts
    tfile = 'index.html'
    if category or tag:
      tfile = 'cattag.html'
      c['title'] += " - Tagged %s" % (tag) if tag else " - Category %s" % (category)
    t = util.getTemplate(tfile)
    return HttpResponse(t.render(c))
  return get404(request, xml_tree, wp_tree)
Get response for showing a list of posts.
dataset/ETHPy150Open DeanCutlet/filestack/views.py/showList