Combine two Layout Policies, is this possible?

I have defined a own LayoutPolicy Class to extends the CSS Classes in the Body-Tag.

<!-- Extends the CSS Body Classess -->
<browser:page
  name="plone_layout"
  for="*"
  permission="zope.Public"
  class=".layout.LayoutPolicy"
  layer="my.addon.interfaces.IMyAddonInstalled"
  allowed_interface="plone.app.layout.globals.interfaces.ILayoutPolicy" />

I have also installed the collective.cover Plugin. In this Package is also a LayoutPolicy Class :

<browser:page
  name="plone_layout"for="collective.cover.interfaces.ICover"
  permission="zope.Public"
  class=".layoutpolicy.LayoutPolicy"
  allowed_interface="plone.app.layout.globals.interfaces.ILayoutPolicy"
  layer="collective.cover.interfaces.ICoverLayer" />

The Policy from collective.cover :

# -*- coding: utf-8 -*-
from plone.app.layout.globals import layout as base
from plone.i18n.normalizer.interfaces import IIDNormalizer
from zope.component import getUtility

class LayoutPolicy(base.LayoutPolicy):
  """Override the default Plone layout utility."""
  def bodyClass(self, template, view):
    """Include layout identifier in bodyClass."""
    body_class = super(LayoutPolicy, self).bodyClass(template, view)
    util = getUtility(IIDNormalizer)
    layout_id = util.normalize(self.context.template_layout)
    return 'cover-layout-{0} {1}'.format(layout_id, body_class)

My Problem, on all Contenttype Pages my Policy matched. But on the Cover-Site it doesn't. I know why, because my Class/Method isn't calling.

Is there a possibility to merge this two Policies via zcml or override/extends... or whatever? Had anyone an idea?

My only Solution is to clone the Collective Cover Product and override the Layout Policy in my Filesystem like:

# -*- coding: utf-8 -*-
from my.addon.globals import layout as base
from plone.i18n.normalizer.interfaces import IIDNormalizer
from zope.component import getUtility

class LayoutPolicy(base.LayoutPolicy):
  """Override the default Plone layout utility."""
  def bodyClass(self, template, view):
    """Include layout identifier in bodyClass."""
    body_class = super(LayoutPolicy, self).bodyClass(template, view)
    util = getUtility(IIDNormalizer)
    layout_id = util.normalize(self.context.template_layout)
    return 'cover-layout-{0} {1}'.format(layout_id, body_class)

You copied the code from c.cover twice, so we can't see the code from your own product.

General principles though, if you get my.addon.interfaces.IMyAddonInstalled to inherit from ICoverLayer then IMyAddonInstalled will be a more specific layer than ICoverLayer & you should be able to register the same class for all types, though you may have to register it twice (for * and for ICover)

<browser:page
  name="plone_layout"
  for="*"
  permission="zope.Public"
  class=".layout.LayoutPolicy"
  layer="my.addon.interfaces.IMyAddonInstalled"
  allowed_interface="plone.app.layout.globals.interfaces.ILayoutPolicy" />

<browser:page
  name="plone_layout"
  for="collective.cover.interfaces.ICover"
  permission="zope.Public"
  class=".layout.LayoutPolicy"
  layer="my.addon.interfaces.IMyAddonInstalled"
  allowed_interface="plone.app.layout.globals.interfaces.ILayoutPolicy" />

Your he code in the bodyClass method can then apply check if it needs to add the cover-layout class in addition to your own by checking if self.context implements the ICover interface

Ok, my Code ist the same like in Collective Cover LayoutPolicy. I check the Request against Mobile Agent and add a CSS-Class 'mobile-version' to the Body. I would test the attribute for="collective.cover.interfaces.ICover *". Thanks for Info