Edgewall Software
Modify

Opened 19 years ago

Closed 19 years ago

Last modified 19 years ago

#2886 closed defect (wontfix)

Definitive list of all interfaces

Reported by: Alec Thomas Owned by: Jonas Borgström
Priority: low Milestone:
Component: general Version: devel
Severity: minor Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

With the number of new plugins implementing interfaces, it would be nice to be able to inspect what is available. This patch adds the list trac.core.InterfaceMeta._interfaces. I envisage an about/interfaces page similar to the existing about/plugins.

  • trac/core.py

     
    3030        self.show_traceback = show_traceback
    3131
    3232
     33class InterfaceMeta(type):
     34    _interfaces = []
     35
     36    def __new__(cls, name, bases, d):
     37        new_class = type.__new__(cls, name, bases, d)
     38        if name != 'Interface':
     39            InterfaceMeta._interfaces.append(new_class)
     40        return new_class
     41
     42
    3343class Interface(object):
    3444    """Marker base class for extension point interfaces."""
    3545
     46    __metaclass__ = InterfaceMeta
    3647
     48
    3749class ExtensionPoint(property):
    3850    """Marker class for extension points in components."""
    3951

Attachments (1)

about-interfaces.diff (5.9 KB ) - added by Alec Thomas 19 years ago.
Add an section on interfaces to about/plugins

Download all attachments as: .zip

Change History (7)

comment:1 by Christopher Lenz, 19 years ago

An interface is useless as long as it isn't bound to an ExtensionPoint. That information, however, should already be available from the component registry (although retrieving it isn't trivial).

In fact, the extension points offered by components are already displayed on the about/plugins page, no?

comment:2 by Alec Thomas, 19 years ago

Perhaps a better place to track this would be in the ExtensionPoint classes, as you say.

And yes, it is available in the about/plugins page, but scouring through that page to find interfaces is not that fun, and it doesn't contain any information about the interface methods.

Perhaps the information collected could be used to generate a list of available extension points at the end of that page. Remove the description of the interfaces that's already there, leaving the list for each plugin though.

I envisaged something like the following:


trac.wiki.api.IWikiChangeListener

Extension point interface for components that should get notified about the creation, deletion and modification of wiki pages.

Interface

wiki_page_added(page)

Called whenever a new Wiki page is added.

wiki_page_changed(page, version, t, comment, author, ipnr)

Called when a page has been modified.

wiki_page_deleted(page)

Called when a page has been deleted.

wiki_page_version_deleted(page)

Called when a version of a page has been deleted.

by Alec Thomas, 19 years ago

Attachment: about-interfaces.diff added

Add an section on interfaces to about/plugins

comment:3 by Alec Thomas, 19 years ago

The attached patch is just a modification of about/plugins. It adds a second section below the plugin list (with appropriate anchor links from the plugins themselves) for interfaces. Each interface encountered is listed, along with full method listing and documentation. There are anchors for each interface and method.

eg. http://localhost/trac-dev/about/plugins#trac.env.IEnvironmentSetupParticipant.environment_needs_upgrade

Doesn't require any changes to trac.core, which is good :)

comment:4 by Alec Thomas, 19 years ago

It does make the page quite huge though. I guess I could add an about/interfaces page, and link between the two?

comment:5 by Alec Thomas, 19 years ago

Resolution: wontfix
Status: newclosed

comment:6 by Christian Boos, 19 years ago

Milestone: 0.10

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jonas Borgström.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jonas Borgström to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.