incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject [31/50] git commit: [#3154] ticket#411 removed sort in export queries
Date Mon, 26 Aug 2013 14:01:10 GMT
[#3154] ticket#411 removed sort in export queries


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/1c24bb70
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/1c24bb70
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/1c24bb70

Branch: refs/heads/tv/6595
Commit: 1c24bb70d92e73e180e8f772c6cb5ff024e3d062
Parents: 526063a
Author: Anton Kasyanov <mind1master@gmail.com>
Authored: Tue Aug 13 14:41:00 2013 +0300
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu Aug 22 20:04:44 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/discuss.py                    | 7 ++++---
 ForgeBlog/forgeblog/main.py                       | 2 +-
 ForgeBlog/forgeblog/tests/test_app.py             | 1 +
 ForgeDiscussion/forgediscussion/forum_main.py     | 2 +-
 ForgeDiscussion/forgediscussion/tests/test_app.py | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1c24bb70/Allura/allura/model/discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py
index ec5ccdc..057bb97 100644
--- a/Allura/allura/model/discuss.py
+++ b/Allura/allura/model/discuss.py
@@ -65,8 +65,8 @@ class Discussion(Artifact, ActivityObject):
             name=self.name,
             description=self.description,
             threads=[t.__json__() for t in self.thread_class().query.find(
-                dict(discussion_id=self._id)).sort(
-                    'last_post_date', pymongo.DESCENDING)])
+                dict(discussion_id=self._id))]
+        )
 
     @property
     def activity_name(self):
@@ -172,7 +172,8 @@ class Thread(Artifact, ActivityObject):
                                           url=h.absurl(attach.url())) for attach in p.attachments])
                    for p in self.post_class().query.find(
                    dict(discussion_id=self.discussion_id, thread_id=self._id, status='ok')
-                   ).sort('timestamp', pymongo.DESCENDING)])
+                   )]
+        )
 
     @property
     def activity_name(self):

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1c24bb70/ForgeBlog/forgeblog/main.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/main.py b/ForgeBlog/forgeblog/main.py
index 6f344cb..3abf4f0 100644
--- a/ForgeBlog/forgeblog/main.py
+++ b/ForgeBlog/forgeblog/main.py
@@ -192,7 +192,7 @@ class ForgeBlogApp(Application):
 
     def bulk_export(self, f):
         f.write('{"posts": [')
-        posts = BM.BlogPost.query.find(dict(app_config_id=self.config._id)).sort('timestamp',
pymongo.DESCENDING)
+        posts = BM.BlogPost.query.find(dict(app_config_id=self.config._id))
         for i, post in enumerate(posts):
             if i > 0:
                 f.write(',')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1c24bb70/ForgeBlog/forgeblog/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeBlog/forgeblog/tests/test_app.py b/ForgeBlog/forgeblog/tests/test_app.py
index 622dccf..7427b9b 100644
--- a/ForgeBlog/forgeblog/tests/test_app.py
+++ b/ForgeBlog/forgeblog/tests/test_app.py
@@ -56,6 +56,7 @@ class TestBulkExport(object):
         blog.bulk_export(f)
         f.seek(0)
         blog = json.loads(f.read())
+        blog['posts'] = sorted(blog['posts'], key=lambda x: x['title'], reverse=True)
         assert_equal(blog['posts'][0]['title'], 'Test2 title')
         assert_equal(blog['posts'][0]['text'], 'test2 post')
         assert_equal(blog['posts'][1]['title'], 'Test title')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1c24bb70/ForgeDiscussion/forgediscussion/forum_main.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/forum_main.py b/ForgeDiscussion/forgediscussion/forum_main.py
index a91508d..54c4bef 100644
--- a/ForgeDiscussion/forgediscussion/forum_main.py
+++ b/ForgeDiscussion/forgediscussion/forum_main.py
@@ -219,7 +219,7 @@ class ForgeDiscussionApp(Application):
 
     def bulk_export(self, f):
         f.write('{"forums": [')
-        forums = DM.Forum.query.find(dict(app_config_id=self.config._id)).sort('mod_date',
pymongo.DESCENDING)
+        forums = DM.Forum.query.find(dict(app_config_id=self.config._id))
         for i, forum in enumerate(forums):
             if i > 0:
                 f.write(',')

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/1c24bb70/ForgeDiscussion/forgediscussion/tests/test_app.py
----------------------------------------------------------------------
diff --git a/ForgeDiscussion/forgediscussion/tests/test_app.py b/ForgeDiscussion/forgediscussion/tests/test_app.py
index d54ab5a..bc9dcb1 100644
--- a/ForgeDiscussion/forgediscussion/tests/test_app.py
+++ b/ForgeDiscussion/forgediscussion/tests/test_app.py
@@ -36,7 +36,7 @@ class TestBulkExport(TestDiscussionApiBase):
         discussion.bulk_export(f)
         f.seek(0)
         discussion = json.loads(f.read())
-        forums = discussion['forums']
+        forums = sorted(discussion['forums'], key=lambda x: x['name'])
 
         assert_equal(forums[0]['shortname'], u'general')
         assert_equal(forums[0]['description'], u'Forum about anything you want to talk about.')


Mime
View raw message