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 C798910EF8 for ; Wed, 15 Jan 2014 19:39:19 +0000 (UTC) Received: (qmail 43337 invoked by uid 500); 15 Jan 2014 19:39:18 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 43296 invoked by uid 500); 15 Jan 2014 19:39:18 -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 43285 invoked by uid 99); 15 Jan 2014 19:39:18 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 15 Jan 2014 19:39:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 0012883419B; Wed, 15 Jan 2014 19:39:17 +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: Wed, 15 Jan 2014 19:39:17 -0000 Message-Id: <5300c4e9b3fa45b8b66e2357f7692c8b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: [#7026] Handle detached artifacts more gracefully Updated Branches: refs/heads/cj/7026 68002e307 -> 7a227dea9 (forced update) [#7026] Handle detached artifacts more gracefully On the off chance that an Artifact or AppConfig gets detached from its project, we want to handle it a bit more gracefully. This situtation shouldn't really come up in production, as it means the data is bad, but it can happen on a sandbox. 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/c7e37bf7 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/c7e37bf7 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/c7e37bf7 Branch: refs/heads/cj/7026 Commit: c7e37bf7bc8fa4cac6b130a22925e130cf20b5ac Parents: f824160 Author: Cory Johns Authored: Wed Jan 15 19:36:51 2014 +0000 Committer: Cory Johns Committed: Wed Jan 15 19:36:55 2014 +0000 ---------------------------------------------------------------------- Allura/allura/model/artifact.py | 2 +- Allura/allura/model/discuss.py | 4 ++++ Allura/allura/model/timeline.py | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c7e37bf7/Allura/allura/model/artifact.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/artifact.py b/Allura/allura/model/artifact.py index 8a01c42..56c7643 100644 --- a/Allura/allura/model/artifact.py +++ b/Allura/allura/model/artifact.py @@ -265,7 +265,7 @@ class Artifact(MappedClass): this Artifact belongs. """ - return self.app_config.project + return getattr(self.app_config, 'project', None) @property def project_id(self): http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c7e37bf7/Allura/allura/model/discuss.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/discuss.py b/Allura/allura/model/discuss.py index 884f736..663adf8 100644 --- a/Allura/allura/model/discuss.py +++ b/Allura/allura/model/discuss.py @@ -496,8 +496,12 @@ class Post(Message, VersionedArtifact, ActivityObject): not have access to a 'comment' activity unless he also has access to the artifact on which it was posted (if there is one). """ + if self.project is None: + return False artifact_access = True if self.thread.artifact: + if self.thread.artifact.project is None: + return False artifact_access = security.has_access(self.thread.artifact, perm, user, self.thread.artifact.project) http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/c7e37bf7/Allura/allura/model/timeline.py ---------------------------------------------------------------------- diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py index 3487b9c..7b350aa 100644 --- a/Allura/allura/model/timeline.py +++ b/Allura/allura/model/timeline.py @@ -89,6 +89,8 @@ class ActivityObject(ActivityObjectBase): """Return True if user has perm access to this object, otherwise return False. """ + if self.project is None: + return False return security.has_access(self, perm, user, self.project)