Browse Source

Added a discover_plugin function to browse plugin directory

m.orban 8 years ago
parent
commit
6787ec1cc8
2 changed files with 14 additions and 1 deletions
  1. 1
    1
      lodel/leapi/datahandlers/base_classes.py
  2. 13
    0
      lodel/plugin/plugins.py

+ 1
- 1
lodel/leapi/datahandlers/base_classes.py View File

@@ -196,7 +196,7 @@ class Reference(DataHandler):
196 196
         if back_reference is not None:
197 197
             if len(back_reference) != 2:
198 198
                 raise ValueError("A tuple (classname, fieldname) expected but got '%s'" % back_reference)
199
-            #if not issubclass(back_reference[0], LeObject) or not isinstance(back_reference[1], str):
199
+            #if not issubclass(lodel.leapi.leobject.LeObject, back_reference[0]) or not isinstance(back_reference[1], str):
200 200
             #    raise TypeError("Back reference was expected to be a tuple(<class LeObject>, str) but got : (%s, %s)" % (back_reference[0], back_reference[1]))
201 201
         self.__back_reference = back_reference
202 202
 

+ 13
- 0
lodel/plugin/plugins.py View File

@@ -110,6 +110,19 @@ class Plugin(object):
110 110
                     filename = confspec_filename)
111 111
                 raise PluginError(msg)
112 112
 
113
+    ##@brief Browse directory to get plugin
114
+    #@param plugin_path 
115
+    #@return module existing
116
+    def _discover_plugin(self, plugin_path):
117
+        import os
118
+        try:
119
+            for root, dirs, files in os.walk(plugin_path, topdown = True):
120
+                return dirs                
121
+        except NameError:
122
+            msg = "This plugin {plugin_path} is not valid"
123
+
124
+
125
+
113 126
     ##@brief Try to import a file from a variable in __init__.py
114 127
     #@param varname str : The variable name
115 128
     #@return loaded module

Loading…
Cancel
Save