def threads(request, document_slug):
 doc = get_document(document_slug, request)
 try:
  sort = int(request.GET.get('sort', 0))
 except ValueError:
  sort = 0
 try:
  desc = int(request.GET.get('desc', 0))
 except ValueError:
  desc = 0
 desc_toggle = (0 if desc else 1)
 threads_ = sort_threads(doc.thread_set, sort, desc)
 threads_ = paginate(request, threads_, per_page=kbforums.THREADS_PER_PAGE)
 feed_urls = ((reverse('wiki.discuss.threads.feed', args=[document_slug]), ThreadsFeed().title(doc)),)
 is_watching_forum = (request.user.is_authenticated() and NewThreadEvent.is_notifying(request.user, doc))
 return render(request, 'kbforums/threads.html', {'document': doc, 'threads': threads_, 'is_watching_forum': is_watching_forum, 'sort': sort, 'desc_toggle': desc_toggle, 'feeds': feed_urls})

def threads ( request , document_slug ) : doc = get_document ( document_slug , request ) try : sort = int ( request . GET . get ( 'sort' , 0 ) ) except ValueError : sort = 0 try : desc = int ( request . GET . get ( 'desc' , 0 ) ) except ValueError : desc = 0 desc_toggle = ( 0 if desc else 1 ) threads_ = sort_threads ( doc . thread_set , sort , desc ) threads_ = paginate ( request , threads_ , per_page = kbforums . THREADS_PER_PAGE ) feed_urls = ( ( reverse ( 'wiki.discuss.threads.feed' , args = [ document_slug ] ) , ThreadsFeed ( ) . title ( doc ) ) , ) is_watching_forum = ( request . user . is_authenticated ( ) and NewThreadEvent . is_notifying ( request . user , doc ) ) return render ( request , 'kbforums/threads.html' , { 'document' : doc , 'threads' : threads_ , 'is_watching_forum' : is_watching_forum , 'sort' : sort , 'desc_toggle' : desc_toggle , 'feeds' : feed_urls } )
dumps out server threads .