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

82 Views Asked by At

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")?

2

There are 2 best solutions below

0
On BEST ANSWER

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>
1
On

If you have a buildout where this plone skin is installed, adding the collective.recipe.omelette to it will help you later being able to grep on all your packages for it.

So something like this will work:

grep -R --include=*.zcml 'My Theme Name' parts/omelette