collective / collective/collective.alias
Use all portlets from original item, including contextual ones
- Dominant language
- Python
- Stars
- 3
- Forks
- 5
- PR merge metrics
- No merged PRs in 30d
Description
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
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with collective.alias.annotations.AliasAnnotations.get and the TODO referenced in the issue. Compare the supplied monkeypatch behavior with the existing annotation lookup, then determine how the control-panel setting should govern contextual portlets and local additions. Done means aliases can use the original item's contextual portlets according to that decision.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100