There's already an issue on the TODO to optionally use all portlets (also contextual ones) from the original.
If you wish to do that, you can patch collective.alias.annotations.AliasAnnotations's get method, in the example below we use colelctive.monkeypatcher to do so. It will remove the ability to add portlets locally.
This code might also be used to properly fix the TODO issue, by adding a check for a controlpanel setting.
from collective.alias.annotations import _marker
from plone.portlets.constants import CONTEXT_ASSIGNMENT_KEY
def AliasAnnotations__get(self, key, default=None):
# Force portlets annotation from self.target, instead of taking
# local annotation
value = _marker
annotations = getattr(self.obj, '__alias_annotations__', _marker)
if annotations is not _marker:
value = annotations.get(key, _marker)
if key == CONTEXT_ASSIGNMENT_KEY or \
value is _marker:
value = self.target.get(key, _marker)
if value is _marker:
return default
return value
There's already an issue on the TODO to optionally use all portlets (also contextual ones) from the original.
If you wish to do that, you can patch collective.alias.annotations.AliasAnnotations's get method, in the example below we use colelctive.monkeypatcher to do so. It will remove the ability to add portlets locally.
This code might also be used to properly fix the TODO issue, by adding a check for a controlpanel setting.