Changeset 1816

Show
Ignore:
Timestamp:
01/30/09 11:17:23 (14 months ago)
Author:
JensDiemer
Message:

Chnage the way to get the plugin_name. The Problem was: self.class.name does not represent in every case the real plugin name! If a big plugin split the plugin methods in smaller file/classes and inherit directly from PyLucidBasePlugin?. e.g. the show_interals does this...
The right plugin name is needed for getting the right internal page files.

Location:
trunk/pylucid_project/PyLucid/system
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pylucid_project/PyLucid/system/BasePlugin.py

    r1804 r1816  
    4747class PyLucidBasePlugin(object): 
    4848 
    49     def __init__(self, context, response): 
    50         self.plugin_name = self.__class__.__name__ 
     49    def __init__(self, context, response, plugin_name): 
     50        self.plugin_name = plugin_name 
    5151        self.internal_page = InternalPage(context, self.plugin_name) 
    5252 
     
    172172        try: 
    173173            content = self.internal_page.get_content(internal_page_name, "html") 
    174         except InternalPageNotFound: 
    175             msg = "Internal page '%s' not found!" % internal_page_name 
     174        except InternalPageNotFound, err: 
     175            if debug: 
     176                msg = err 
     177            else:     
     178                msg = "Internal page '%s' not found!" % internal_page_name 
    176179            self.page_msg.red(msg) 
    177180            return "[%s]" % msg 
  • trunk/pylucid_project/PyLucid/system/plugin_manager.py

    r1731 r1816  
    109109 
    110110    plugin_class = getattr(plugin_module, plugin_name) 
    111 #    page_msg(plugin_class, type(plugin_class) 
    112     class_instance = plugin_class(context, local_response) 
     111    #request.page_msg(plugin_class, type(plugin_class), plugin_name) 
     112    class_instance = plugin_class(context, local_response, plugin_name) 
    113113    unbound_method = getattr(class_instance, method_name) 
    114114