Show
Ignore:
Timestamp:
05/02/08 16:47:16 (23 months ago)
Author:
JensDiemer
Message:

update preferences:

  • move the preferences form from the plugin module into the plugin config modul
  • a plugin must not use try...except to get the preferences
  • update all modules around the plugin install/deinstall etc.
  • detect_page used the system_settings "index_page" value (setup a other default index page works!)
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid/PyLucid/system/plugin_import.py

    r1548 r1551  
    11# -*- coding: utf-8 -*- 
    2  
    32""" 
    43    PyLucid Plugin Manager 
     
    5251        page_msg(getattr(plugin_config, item)) 
    5352 
    54 def get_plugin_config(request, package_name, plugin_name, 
    55                             dissolve_version_string=False, extra_verbose=False): 
     53def get_plugin_config(package_name, plugin_name, debug, extra_verbose=False): 
    5654    """ 
    5755    imports the plugin and the config plugin and returns a merge config-object 
     
    6159    """ 
    6260    config_name = "%s_cfg" % plugin_name 
    63     debug = request.user.is_superuser or request.debug 
     61    from_name = ".".join([package_name, plugin_name, config_name]) 
     62    if extra_verbose: 
     63        print "from %s import %s" % (from_name, config_name) 
    6464 
    65     def get_plugin(object_name): 
    66         from_name = ".".join([package_name, plugin_name, object_name]) 
    67         if extra_verbose: 
    68             print "from %s import %s" % (from_name, object_name) 
    69         return _import(from_name, object_name, debug) 
    70  
    71     config_plugin = get_plugin(config_name) 
    72  
    73     if dissolve_version_string: 
    74         plugin_plugin = get_plugin(plugin_name) 
    75  
    76         plugin_version = getattr(plugin_plugin, "__version__", None) 
    77         if plugin_version: 
    78             # Cleanup a SVN Revision Number 
    79             plugin_version = plugin_version.strip("$ ") 
    80         config_plugin.__version__ = plugin_version 
     65    config_plugin = _import(from_name, config_name, debug) 
    8166 
    8267    return config_plugin 
     68 
     69def get_plugin_version(package_name, plugin_name, debug): 
     70    plugin_plugin = get_plugin_module(package_name, plugin_name, debug) 
     71 
     72    plugin_version = getattr(plugin_plugin, "__version__", "") 
     73 
     74    # Cleanup a SVN Revision Number 
     75    plugin_version = plugin_version.strip("$ ") 
     76 
     77    return plugin_version 
    8378 
    8479 
     
    8782 
    8883 
    89  
    90