Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Diff of /Allura/allura/model/discuss.py [80bffb] .. [a29e77] Maximize Restore

  Switch to side-by-side view

--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -1,4 +1,3 @@
-import sys
 import logging
 from datetime import datetime
 
@@ -290,9 +289,6 @@
 
     def query_posts(self, page=None, limit=None,
                     timestamp=None, style='threaded'):
-        if limit is None:
-            limit = 50
-        limit = int(limit)
         if timestamp:
             terms = dict(discussion_id=self.discussion_id, thread_id=self._id,
                     status={'$in': ['ok', 'pending']}, timestamp=timestamp)
@@ -304,9 +300,10 @@
             q = q.sort('full_slug')
         else:
             q = q.sort('timestamp')
-        if page is not None:
-            q = q.skip(page * limit)
         if limit is not None:
+            limit = int(limit)
+            if page is not None:
+                q = q.skip(page * limit)
             q = q.limit(limit)
         return q
 
@@ -518,7 +515,7 @@
             # all posts in a single page
             page = 0
         else:
-            posts = self.thread.find_posts(None, sys.maxint)
+            posts = self.thread.find_posts()
             posts = self.thread.create_post_threads(posts)
 
             def find_i(posts):