Advertisement
reddit

Untitled

Sep 6th, 2010
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py
  2. index 4874852..2d4392a 100644
  3. --- a/r2/r2/controllers/listingcontroller.py
  4. +++ b/r2/r2/controllers/listingcontroller.py
  5. @@ -790,7 +790,10 @@ class CommentsController(ListingController):
  6. title_text = _('comments')
  7.  
  8. def query(self):
  9. - return c.site.get_all_comments()
  10. + if c.site == Default:
  11. + return c.site.get_all_comments()
  12. + else:
  13. + return queries.get_sr_comments(c.site)
  14.  
  15. def GET_listing(self, **env):
  16. c.profilepage = True
  17.  
  18. diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py
  19. index 18ab876..d3b020a 100644
  20. --- a/r2/r2/lib/db/queries.py
  21. +++ b/r2/r2/lib/db/queries.py
  22. @@ -460,6 +460,12 @@ def get_all_comments():
  23. q = Comment._query(sort = desc('_date'))
  24. return make_results(q)
  25.  
  26. +def get_sr_comments(sr):
  27. + """r/subreddit/comments page"""
  28. + comments = Comment._query(Comment.c.sr_id == sr._id,
  29. + sort = desc('_date'))
  30. + return comments
  31. +
  32. def get_comments(user, sort, time):
  33. return user_query(Comment, user, sort, time)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement