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 91491108C1 for ; Tue, 23 Jul 2013 22:36:18 +0000 (UTC) Received: (qmail 69620 invoked by uid 500); 23 Jul 2013 22:36:18 -0000 Delivered-To: apmail-incubator-allura-commits-archive@incubator.apache.org Received: (qmail 69584 invoked by uid 500); 23 Jul 2013 22:36: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 69534 invoked by uid 99); 23 Jul 2013 22:36: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; Tue, 23 Jul 2013 22:36:18 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 610458B2CC6; Tue, 23 Jul 2013 22:36:18 +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, 23 Jul 2013 22:36:41 -0000 Message-Id: In-Reply-To: <93658d91c1b94fa9b2b08eecb557849c@git.apache.org> References: <93658d91c1b94fa9b2b08eecb557849c@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [25/27] git commit: [#5517] add permission_desc docstring; remove caching [#5517] add permission_desc docstring; remove caching Caching can be incorrect if it's called on a class in the middle of the hierarchy. Any subclasses after it won't have their descriptions merged in Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/61d0ca57 Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/61d0ca57 Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/61d0ca57 Branch: refs/heads/cj/6456 Commit: 61d0ca575cf4583f5e6d14a8017fd456315af1b8 Parents: 8a920b9 Author: Dave Brondsema Authored: Tue Jul 23 21:06:41 2013 +0000 Committer: Dave Brondsema Committed: Tue Jul 23 21:07:32 2013 +0000 ---------------------------------------------------------------------- Allura/allura/app.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/61d0ca57/Allura/allura/app.py ---------------------------------------------------------------------- diff --git a/Allura/allura/app.py b/Allura/allura/app.py index 2b839fc..c1d2517 100644 --- a/Allura/allura/app.py +++ b/Allura/allura/app.py @@ -176,6 +176,7 @@ class Application(object): Application. Default is True. :cvar list permissions: Named permissions used by instances of this Application. Default is []. + :cvar dict permissions_desc: Descriptions of the named permissions. :cvar bool installable: Default is True, Application can be installed in projects. :cvar bool hidden: Default is False, Application is not hidden from the @@ -282,12 +283,10 @@ class Application(object): Returns empty string if there is no description for ``permission``. """ - if not hasattr(cls, '_permissions_desc'): - d = {} - for t in reversed(cls.__mro__): - d = dict(d, **getattr(t, 'permissions_desc', {})) - cls._permissions_desc = d - return cls._permissions_desc.get(permission, '') + d = {} + for t in reversed(cls.__mro__): + d = dict(d, **getattr(t, 'permissions_desc', {})) + return d.get(permission, '') def parent_security_context(self): """Return the parent of this object.