aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/moon_utilities
diff options
context:
space:
mode:
authorRuan HE <ruan.he@orange.com>2017-12-21 09:45:55 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-12-21 09:45:55 +0000
commit7a35259d6c4a710433a9eb5ee4d29797f1516d4b (patch)
treee157fcae19066c5c7dfe58fcc3abbe9726780b1b /moonv4/moon_utilities
parent8b326a5aeb0f9655ff0ebfe0d87ff1ea8f66bc38 (diff)
parentd0f464c27cd2e16ee1049a158bd453f57124ec92 (diff)
Merge "comments needed to be done"
Diffstat (limited to 'moonv4/moon_utilities')
-rw-r--r--moonv4/moon_utilities/moon_utilities/cache.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/moonv4/moon_utilities/moon_utilities/cache.py b/moonv4/moon_utilities/moon_utilities/cache.py
index d62c9d54..8c6ee3bf 100644
--- a/moonv4/moon_utilities/moon_utilities/cache.py
+++ b/moonv4/moon_utilities/moon_utilities/cache.py
@@ -9,6 +9,12 @@ LOG = logging.getLogger("moon.utilities.cache")
class Cache(object):
# TODO (asteroide): set cache integer in CONF file
+ '''
+ [NOTE] Propose to define the following variables inside the init method
+ as defining them out side the init, will be treated as private static variables
+ and keep tracks with any changes done anywhere
+ for more info : you can check https://docs.python.org/3/tutorial/classes.html#class-and-instance-variables
+ '''
__UPDATE_INTERVAL = 10
__CONTAINERS = {}
@@ -196,6 +202,15 @@ class Cache(object):
def get_subject_assignments(self, policy_id, perimeter_id, category_id):
if policy_id not in self.subject_assignments:
self.update_subject_assignments(policy_id, perimeter_id)
+ '''
+ [NOTE] invalid condition for testing existence of policy_id
+ because update_subject_assignments function already add an empty object
+ with the given policy_id and then assign the response to it
+ as mentioned in these lines of code (line 191,192)
+
+ Note: the same condition applied for the object,action assignment
+ line 234, 260
+ '''
if policy_id not in self.subject_assignments:
raise Exception("Cannot found the policy {}".format(policy_id))
for key, value in self.subject_assignments[policy_id].items():