Browse Source

Debug Metaclass to get child from Plugin Class

m.orban 8 years ago
parent
commit
e4f0bd2358
1 changed files with 15 additions and 10 deletions
  1. 15
    10
      lodel/plugin/plugins.py

+ 15
- 10
lodel/plugin/plugins.py View File

163
         if len(bases) == 1 and bases[0] == object:
163
         if len(bases) == 1 and bases[0] == object:
164
             print("Dropped : ", name, bases)
164
             print("Dropped : ", name, bases)
165
             return
165
             return
166
-        list_name= [cls._name__ for cls in plugin_types(self)] 
167
-        if self.name is in list_name:
168
-            return
169
-        else:
170
-            plug_type_register(self)
166
+        self.__register_types()
167
+        #list_name= [cls.__name__ for cls in __all_ptypes] 
168
+        #if self.name in list_name:
169
+        #    return
170
+        #else:
171
+        #    plug_type_register(self)
172
+
173
+    def __register_types(self):
174
+        plug_type_register(self)
171
 
175
 
172
 def plug_type_register(cls):
176
 def plug_type_register(cls):
173
-    __all__ptypes.append(cls)
177
+    __all_ptypes.append(cls)
174
     logger.info("New child class registered : %s" % cls.__name__)
178
     logger.info("New child class registered : %s" % cls.__name__)
175
 
179
 
176
-##@brief Return a list of child Class Plugin
177
-@classmethod
178
-def plugin_types(cls):
179
-    return cls.__all_ptypes
180
 
180
 
181
 ##@brief Handle plugins
181
 ##@brief Handle plugins
182
 #
182
 #
639
         cls._plugin_list = infos['plugins']
639
         cls._plugin_list = infos['plugins']
640
         return cls._plugin_list
640
         return cls._plugin_list
641
 
641
 
642
+    ##@brief Return a list of child Class Plugin
643
+    @classmethod
644
+    def plugin_types(cls):
645
+        return cls.__all_ptypes
646
+
642
     ##@brief Attempt to open and load plugin discover cache
647
     ##@brief Attempt to open and load plugin discover cache
643
     #@return discover cache
648
     #@return discover cache
644
     #@throw PluginError when open or load fails
649
     #@throw PluginError when open or load fails

Loading…
Cancel
Save