Return-Path: X-Original-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-allura-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 473CC1059C for ; Tue, 2 Jul 2013 02:03:57 +0000 (UTC) Received: (qmail 8492 invoked by uid 500); 2 Jul 2013 02:03:57 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 8457 invoked by uid 500); 2 Jul 2013 02:03:57 -0000 Mailing-List: contact allura-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: allura-dev@incubator.apache.org Delivered-To: mailing list allura-commits@incubator.apache.org Received: (qmail 8418 invoked by uid 99); 2 Jul 2013 02:03:57 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 Jul 2013 02:03:57 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EBD3E530AE; Tue, 2 Jul 2013 02:03:56 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: johnsca@apache.org To: allura-commits@incubator.apache.org Date: Tue, 02 Jul 2013 02:04:00 -0000 Message-Id: In-Reply-To: <291f896ff6f143838257508b5fb74370@git.apache.org> References: <291f896ff6f143838257508b5fb74370@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [5/5] git commit: [#6056] Improved loading of discussion post by slug [#6056] Improved loading of discussion post by slug Signed-off-by: Cory Johns Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/a27becec Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/a27becec Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/a27becec Branch: refs/heads/cj/6056 Commit: a27bececd1bfdc8ae3141ff8cbd3c39e34fcb155 Parents: 1491096 Author: Cory Johns Authored: Tue Jul 2 02:02:54 2013 +0000 Committer: Cory Johns Committed: Tue Jul 2 02:02:54 2013 +0000 ---------------------------------------------------------------------- Allura/allura/controllers/discuss.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/a27becec/Allura/allura/controllers/discuss.py ---------------------------------------------------------------------- diff --git a/Allura/allura/controllers/discuss.py b/Allura/allura/controllers/discuss.py index 4fa05c8..9ff5e6c 100644 --- a/Allura/allura/controllers/discuss.py +++ b/Allura/allura/controllers/discuss.py @@ -256,11 +256,12 @@ class PostController(BaseController): @LazyProperty def post(self): - result = self.M.Post.query.find(dict(slug=self._post_slug)).all() - for p in result: - if p.thread_id == self.thread._id: return p - if result: - redirect(result[0].url()) + post = self.M.Post.query.get(slug=self._post_slug, thread_id=self.thread._id) + if post: + return post + post = self.M.Post.query.get(slug=self._post_slug) + if post: + return post else: redirect('..')