On Mon, Dec 5, 2011 at 11:17 AM, Chris Nelson <[email protected]>
wrote:
> On 12/05/2011 09:51 AM, Olemis Lang 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
>> ;)
>
>
> I'm not using an ExtensionPoint. I mention that only because I understand
> that is a way to have pluggable interfaces. I don't know what a
> "trac.config.ExtensionOption descriptor" is.
>
like I supposed ... a little RTFM might save your day here ...
;)
> My trac.ini says:
>
> [TracPM]
> ...
> calendar = teamcalendar.calendar.TeamCalendar
>
Try either this
{{{
[TracPM]
...
calendar = TeamCalendar
}}}
... or maybe is it that teamcalendar.calendar.TeamCalendar component is not
enabled ?
just wondering .
> and my code says:
>
> cal = ExtensionOption('TracPM', 'calendar',
> IResourceCalendar, 'SimpleCalendar')
>
there you have it !
the bloody `ExtensionOption` monster ...
:)
> and I see:
>
> Cannot find an implementation of the "IResourceCalendar" interface
> named "teamcalendar.calendar.TeamCalendar". Please update the
> option TracPM.calendar in trac.ini.
>
>
[...]
>
> I don't know what's missing!
>
try suggestions above and , if they don't work , ask again, again , ... and
again.
Robin Hood is here to help you .
;)
--
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
Get a signature like this.
<http://r1.wisestamp.com/r/landing?promo=17&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_17>
CLICK
HERE.<http://r1.wisestamp.com/r/landing?promo=17&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_17>
--
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.