Browse Source

Refactor Plugin.module_name()

Hicham Benjelloun 7 years ago
parent
commit
844b4eafb9
1 changed files with 5 additions and 3 deletions
  1. 5
    3
      lodel/plugin/plugins.py

+ 5
- 3
lodel/plugin/plugins.py View File

@@ -431,9 +431,11 @@ name differ from the one found in plugin's init file"
431 431
 
432 432
     ##@brief Return associated module name
433 433
     def module_name(self):
434
-        #WOOT WE LOVE DIRTY WORKAROUNDS !!!
435
-        return "lodel.plugins."+os.path.basename(self.path)
436
-        #END OF DIRTY WORKAROUND
434
+        path_array = self.path.split('/')
435
+        if not self.path.startswith('./plugins'):
436
+            raise PluginError("Bad path for plugin %s : %s" % (
437
+                self.name, self.path))
438
+        return '.'.join(['lodel'] + path_array[path_array.index('plugins'):])
437 439
 
438 440
     ##@brief Check dependencies of plugin
439 441
     #@return A list of plugin name to be loaded before

Loading…
Cancel
Save