Kaynağa Gözat

Refactor Plugin.module_name()

Hicham Benjelloun 7 yıl önce
ebeveyn
işleme
844b4eafb9
1 değiştirilmiş dosya ile 5 ekleme ve 3 silme
  1. 5
    3
      lodel/plugin/plugins.py

+ 5
- 3
lodel/plugin/plugins.py Dosyayı Görüntüle

@@ -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…
İptal
Kaydet