allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kentontay...@apache.org
Subject [allura] 01/02: [#8272] remove a dead function
Date Thu, 14 Mar 2019 18:25:22 GMT
This is an automated email from the ASF dual-hosted git repository.

kentontaylor pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 2f5b3ff894892fdfbc770f3ee0e137341e6a867d
Author: Dave Brondsema <dave@brondsema.net>
AuthorDate: Wed Mar 13 14:41:03 2019 -0400

    [#8272] remove a dead function
---
 ForgeDiscussion/forgediscussion/model/forum.py    | 10 ----------
 ForgeDiscussion/forgediscussion/tests/test_app.py |  5 ++++-
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/ForgeDiscussion/forgediscussion/model/forum.py b/ForgeDiscussion/forgediscussion/model/forum.py
index ce54156..481fe92 100644
--- a/ForgeDiscussion/forgediscussion/model/forum.py
+++ b/ForgeDiscussion/forgediscussion/model/forum.py
@@ -59,16 +59,6 @@ class Forum(M.Discussion):
     def thread_class(cls):
         return ForumThread
 
-    @LazyProperty
-    def sorted_threads(self):
-        threads = self.thread_class().query.find(dict(discussion_id=self._id))
-        threads = threads.sort([('last_post_date', pymongo.DESCENDING)]).all()
-        sorted_threads = chain(
-            (t for t in threads if 'Announcement' in t.flags),
-            (t for t in threads if 'Sticky' in t.flags and 'Announcement' not in t.flags),
-            (t for t in threads if 'Sticky' not in t.flags and 'Announcement' not in t.flags))
-        return list(sorted_threads)
-
     @property
     def parent(self):
         return Forum.query.get(_id=self.parent_id)
diff --git a/ForgeDiscussion/forgediscussion/tests/test_app.py b/ForgeDiscussion/forgediscussion/tests/test_app.py
index 39df2f0..90f83bf 100644
--- a/ForgeDiscussion/forgediscussion/tests/test_app.py
+++ b/ForgeDiscussion/forgediscussion/tests/test_app.py
@@ -22,6 +22,7 @@
 import tempfile
 import json
 import os
+from operator import attrgetter
 
 from nose.tools import assert_equal
 from pylons import tmpl_context as c
@@ -69,7 +70,9 @@ class TestBulkExport(TestDiscussionApiBase):
     def test_export_with_attachments(self):
         project = M.Project.query.get(shortname='test')
         discussion = project.app_instance('discussion')
-        post = Forum.query.get(shortname='general').sorted_threads[0].first_post
+        thread = sorted(Forum.query.get(shortname='general').threads,
+                        key=attrgetter('last_post_date'))[-1]
+        post = thread.first_post
         test_file1 = FieldStorage()
         test_file1.name = 'file_info'
         test_file1.filename = 'test_file'


Mime
View raw message