problem with hack using multiple inheritance for plugins
Bruno Desthuilliers
bruno.42.desthuilliers at wtf.websiteburo.oops.com
Thu Jun 28 11:26:35 EDT 2007
massimo s. a écrit :
> On 28 Giu, 13:45, Bruno Desthuilliers <bruno.
> 42.desthuilli... at wtf.websiteburo.oops.com> wrote:
>> <side-note>
>> wrt/ this snippet:
>>
>> for plugin_name in self.config['plugins']:
>> try:
>> plugin=__import__(plugin_name)
>> try:
>> print type(self)
>> eval('plugin.'+plugin_name+'Commands._plug_init(self)')
>> except AttributeError:
>> pass
>> except ImportError:
>> pass
>>
>> You may want to try this instead:
>>
>> for plugin_name in self.config['plugins']:
>> try:
>> plugin=__import__(plugin_name)
>> except ImportError:
>> # eventually do something like logging the error ?
>> continue
>> try:
>> cmdplug = getattr(plugin, plugin_name+'Commands')
>> cmdplug._plug_init(self)
>> except AttributeError:
>> # eventually do something like logging the error ?
>> continue
>
> Tried, same error as before :(
>
Sorry, I failed to make clear that this was not suppoed to solve your
current problem - just to avoid using eval() when not necessary.
More information about the Python-list
mailing list