You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2019/03/13 18:42:51 UTC
[allura] 01/02: [#8272] remove a dead function
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/8272
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 92c36946c0a99d7f329bb508cdcd272d07221ffa
Author: Dave Brondsema <da...@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'