Skip to content

Commit

Permalink
Fixed bugs regarding to self referencing to the core class.
Browse files Browse the repository at this point in the history
  • Loading branch information
Juti Noppornpitak committed Oct 6, 2016
1 parent 1e9d836 commit 65cb661
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions imagination/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def get(self, entity_id : str):
""" Retrieve an entity by ID """
global CORE_SELF_REFERENCE

info = self.get_info(entity_id)

if entity_id == CORE_SELF_REFERENCE:
return self

info = self.get_info(entity_id)

# with exclusive_lock(self.__internal_lock):
# On the first request, the core will be on lockdown.
if not self.is_on_lockdown():
Expand All @@ -86,6 +86,9 @@ def get(self, entity_id : str):

# Activate all dependencies.
for dependency_id in info.activation_sequence:
if dependency_id == CORE_SELF_REFERENCE:
continue

self.get_info(dependency_id).activate()

# Activate the requested container ID.
Expand Down Expand Up @@ -147,6 +150,11 @@ def get_interceptions(self, intercepted_id, event_type = None,
return sub_graph[event_type][method_to_intercept]

def _calculate_activation_sequence(self, entity_id):
global CORE_SELF_REFERENCE

if entity_id == CORE_SELF_REFERENCE:
return []

activation_sequence = []
scoreboard = {} # id -> number of dependants

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name = 'imagination',
version = '2.1.2',
version = '2.1.5',
description = 'Reusable Component Framework',
author = 'Juti Noppornpitak',
author_email = 'juti_n@yahoo.co.jp',
Expand Down

0 comments on commit 65cb661

Please sign in to comment.