[Trac-tickets] [The Trac Project] #2886: Definitive list of all interfaces

The Trac Project noreply at edgewall.com
Thu Mar 16 08:23:45 CST 2006


#2886: Definitive list of all interfaces
---------------------+------------------------------------------------------
 Reporter:  athomas  |       Owner:  jonas
     Type:  defect   |      Status:  new  
 Priority:  low      |   Milestone:  0.10 
Component:  general  |     Version:  devel
 Severity:  minor    |    Keywords:       
---------------------+------------------------------------------------------
 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`.

 {{{
 #!diff
 Index: trac/core.py
 ===================================================================
 --- trac/core.py        (revision 2983)
 +++ trac/core.py        (working copy)
 @@ -30,10 +30,22 @@
          self.show_traceback = show_traceback


 +class InterfaceMeta(type):
 +    _interfaces = []
 +
 +    def __new__(cls, name, bases, d):
 +        new_class = type.__new__(cls, name, bases, d)
 +        if name != 'Interface':
 +            InterfaceMeta._interfaces.append(new_class)
 +        return new_class
 +
 +
  class Interface(object):
      """Marker base class for extension point interfaces."""

 +    __metaclass__ = InterfaceMeta

 +
  class ExtensionPoint(property):
      """Marker class for extension points in components."""

 }}}

-- 
Ticket URL: <http://projects.edgewall.com/trac/ticket/2886>
The Trac Project <http://trac.edgewall.com/>


More information about the Trac-Tickets mailing list