diff options
author | sgdt6900 <rhanafy.ext@orange.com> | 2017-12-21 11:39:47 +0200 |
---|---|---|
committer | sgdt6900 <rhanafy.ext@orange.com> | 2017-12-21 11:39:47 +0200 |
commit | d0f464c27cd2e16ee1049a158bd453f57124ec92 (patch) | |
tree | 40fbf04ddbe826dccc8f5e4bf8915603c2d19eaa /moonv4 | |
parent | a7f99c33c0b2b2c617dd044e658a263ae910b53a (diff) |
comments needed to be done
Change-Id: I0214fa7d30539daa0fc0e62465299ebf643eb356
Signed-off-by: sgdt6900 <rhanafy.ext@orange.com>
Diffstat (limited to 'moonv4')
-rw-r--r-- | moonv4/moon_utilities/moon_utilities/cache.py | 15 |
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(): |