On Mon, Dec 5, 2011 at 9:51 AM, Olemis Lang <[email protected]> wrote:
> On Mon, Dec 5, 2011 at 9:37 AM, Chris Nelson <[email protected]> wrote:
>>
>> On 12/05/2011 09:06 AM, Olemis Lang wrote:
>>>
>>> On Mon, Dec 5, 2011 at 7:57 AM, Chris Nelson<[email protected]>  
>>> wrote:
>>> I think you are missing the point here that ExtensionOption offers a
>>> way to instantiate Components by relying on Python descriptors magic .
>>> Hence that's not the way to go if you want to list the entries under
>>> [components] section in trac.ini . I mentioned before you have
>>> basically two ways to go :
>>>
>>> - Use `env.config` object so as to read information in trac.ini file 
>>> directly
>>> - Use  `ComponentMeta._registry` to list the classes implementing a
>>> given interface
>>>   (review the code for `ExtensionPoint.extensions` method for further 
>>> details ;)
>>>   and then invoke `ComponentManager.is_component_enabled` so as to
>>>   know whether that particular class is enabled/disabled in that particular
>>>   Trac environment.
>>
>>
>> I understand there are several ways to do this. If I wanted multiple 
>> listeners or processors or whatever, I could use an ExtensionPoint and 
>> iterate over all the enabled implementations.  But what I want is a 
>> configurable single handler.  I believe that the way to do that is an 
>> ExtensionOption.  I've used that successfully for functions in my own plugin 
>> but when I try to instantiate an implementation in another plugin, it fails.
>>
>> The class TeamCalendar is implemented in the module calendar.py in the 
>> plugin teamcalendar but when I pass "teamcalendar.calendar.TeamCalendar' to 
>> ExtensionOption, it fails to find the class.
>>
>>   Cannot find an implementation of the "IResourceCalendar" interface
>>   named "teamcalendar.calendar.TeamCalendar".  Please update the
>>   option TracPM.calendar in trac.ini.
>>
>> How can I find the real name of the class?
>>
>
> In that case you should use trac.config.ExtensionOption descriptors ,
> rather than defining extension points
> ;)
>

Or maybe trac.config.OrderedExtensionsOption descriptors if multiple
values are allowed,

--
Regards,

Olemis

Facebook => http://www.facebook.com/olemis
Twitter => http://www.twitter.com/olemislc (@olemislc)
Blog ES => http://simelo-es.blogspot.com
Blog EN => http://simelo-en.blogspot.com
Quora => http://www.quora.com/olemis
Youtube => http://youtube.com/user/greatsoftw

Featured article : Datos de autor bajo resultados de búsqueda de Google
http://feedproxy.google.com/~r/simelo-news/~3/k1F5K6CX91s/datos-de-autor-bajo-resultados-de.html
Get a signature like this. CLICK HERE.

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to