plonezopezope3

Getting the interface of a Zope 3 browser layer knowing only it's name


Having a Plone skin interface registered as follow:

  <interface
      interface=".interfaces.IThemeSpecific"
      type="zope.publisher.interfaces.browser.IBrowserSkinType"
      name="My Theme Name"
      />

What is the simplest way to get the interface (my.app.browser.interfaces.IThemeSpecific) knowing the name ("My Theme Name")?


Solution

  • Probably this:

    >>> from zope.component import getUtility 
    >>> from zope.publisher.interfaces.browser import IBrowserSkinType
    >>> getUtility(IBrowserSkinType, name="Old Plone 3 Custom Theme")
    <InterfaceClass plonetheme.classic.browser.interfaces.IThemeSpecific>