Changeset 1548 for trunk/pylucid/PyLucid/system/plugin_import.py
- Timestamp:
- 05/01/08 12:24:21 (23 months ago)
- Files:
-
- 1 modified
-
trunk/pylucid/PyLucid/system/plugin_import.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pylucid/PyLucid/system/plugin_import.py
r1544 r1548 21 21 22 22 23 def _import( request, from_name, object_name):23 def _import(from_name, object_name, debug): 24 24 """ 25 25 from 'from_name' import 'object_name' … … 28 28 return __import__(from_name, {}, {}, [object_name]) 29 29 except (ImportError, SyntaxError), e: 30 if request.user.is_superuser or request.debug:30 if debug: 31 31 raise 32 32 raise ImportError, "Can't import %s from %s: %s" % ( … … 34 34 ) 35 35 36 def get_plugin_module( request, package_name, plugin_name):37 plugin_module = _import( request,36 def get_plugin_module(package_name, plugin_name, debug): 37 plugin_module = _import( 38 38 from_name = ".".join([package_name, plugin_name, plugin_name]), 39 object_name = plugin_name 39 object_name = plugin_name, 40 debug = debug, 40 41 ) 41 42 return plugin_module 42 43 43 #def get_plugin_class(request, package_name, plugin_name): 44 # """ 45 # import the plugin/plugin and returns the class object 46 # """ 47 # plugin_module = get_plugin_module(request, package_name, plugin_name) 48 # plugin_class = getattr(plugin_module, plugin_name) 49 # return plugin_class 44 # debug = request.user.is_superuser or request.debug 45 50 46 51 47 def debug_plugin_config(page_msg, plugin_config): … … 65 61 """ 66 62 config_name = "%s_cfg" % plugin_name 63 debug = request.user.is_superuser or request.debug 67 64 68 65 def get_plugin(object_name): … … 70 67 if extra_verbose: 71 68 print "from %s import %s" % (from_name, object_name) 72 return _import( request, from_name, object_name)69 return _import(from_name, object_name, debug) 73 70 74 71 config_plugin = get_plugin(config_name)