incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [25/27] git commit: [#5517] add permission_desc docstring; remove caching
Date Tue, 23 Jul 2013 22:36:41 GMT
[#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 <dbrondsema@slashdotmedia.com>
Authored: Tue Jul 23 21:06:41 2013 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
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.


Mime
View raw message