On 28.07.2011 19:25, Chris Nelson wrote:
I think I understand that when a plugin says "Implements(foo)" that the
core builds up a list of plugins that implement "foo" but how does code
that needs foo iterate over or find the implementations in the system?
There's usually one Component that acts as the owner of all implementations of a certain interface. It contains something like
        allfoos = ExtensionPoint(IFoo)
or
        foo = ExtensionOption(IFoo)
or
        orderedfoos = OrderedExtensionsOption(IFoo)
and then "allfoos" contains all the implementations, or "foo" contains the implementation selected in trac.ini, or "orderedfoos" contains the ordered list of implementations selected in trac.ini.

Any other code should use the interface implementations indirectly through that component.

This is also described in http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture (see #Declaringanextensionpoint and #HowcomponentsareusedinTracscode).

BTW, it says, "You can view a list of provided extension points on the
page About Trac/Plugins of your Trac installation." but when I click
"About Trac" in my ribbon then add "Plugins" to the URL, nothing happens
and there seems to be no Plugins title anywhere on that page.

Strange. I'm not sure that this refers to either. I see a section "Installed Plugins" on /about. There's also /admin/general/plugin. But neither of those list extension points. However the TracDeveloperPlugin linked by Christian provides this at /developer/plugins.

How about naming?  I presume all the trac.* namespace belongs to the
Trac project (core, wiki, etc.).
Right.

> Is there a guide for creating new namespace?
I'm not aware of a guide specific to Trac. There are probably many guides for namespaces (in Python) in general.

> Can I start a tracpm (Trac project management) top level and
build in it?  (Is the "trac" prefix there redundant?

I'd say just pick something similar to you plugin name, or anything you think will not conflict with other plugins or common Python libraries.
http://www.google.com/search?q="import+tracpm"+or+"from+tracpm";
comes up empty, so that seems safe.

> What other top-level namespaces exist?

tracopt is for optional components that come with Trac itself.

Peter

--
You received this message because you are subscribed to the Google Groups "Trac 
Development" 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-dev?hl=en.

Reply via email to