Browse Source

Changed loader context behavior

Now the loader context is threated like the others (it loads it's libs from a symlink, before it was loading them from lodel package)
Yann Weber 8 years ago
parent
commit
b2e904ad58
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      lodel/context.py

+ 8
- 4
lodel/context.py View File

@@ -84,6 +84,9 @@ class LodelMetaPathFinder(importlib.abc.MetaPathFinder):
84 84
 
85 85
 ##@brief Class designed to handle context switching and virtual module
86 86
 #exposure
87
+#
88
+#@note a dedicated context named LOAD_CTX is used as context for the 
89
+#loading process
87 90
 class LodelContext(object):
88 91
     
89 92
     ##@brief FLag telling that the context handler is in single context mode
@@ -104,7 +107,7 @@ class LodelContext(object):
104 107
     ##@brief Create a new context
105 108
     #@see LodelContext.new()
106 109
     def __init__(self, site_id, instance_path = None):
107
-        print("Registering new context for '%s'" % site_id)
110
+        print("New context instanciation named '%s'" % site_id)
108 111
         if site_id is None:
109 112
             #Monosite instanciation
110 113
             if self.__class__._type != self.__class__.MONOSITE:
@@ -129,9 +132,8 @@ site_id when we are in MONOSITE beahvior")
129 132
                     "A context named '%s' allready exists." % site_id)
130 133
             self.__id = site_id
131 134
             self.__pkg_name = '%s.%s' % (CTX_PKG, site_id)
132
-            if self.__id == LOAD_CTX:
133
-                self.__pkg_name = 'lodel'
134
-            elif instance_path is None:
135
+
136
+            if instance_path is None:
135 137
                 """
136 138
                 raise ContextError("Cannot create a context without an \
137 139
 instance path")
@@ -233,6 +235,8 @@ submodule : '%s'" % module_fullname)
233 235
     #@return the context instance
234 236
     @classmethod
235 237
     def new(cls, site_id, instance_path = None):
238
+        if site_id is None:
239
+            site_id = LOAD_CTX
236 240
         return cls(site_id, instance_path)
237 241
 
238 242
     ##@brief Helper function that import and expose specified modules

Loading…
Cancel
Save