plone / plone/plone.folder

orderObjects does not fire ContainerModifiedEvent (moveObjectsByDelta does)

Open
#65 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2
Forks
3
Avg merge
1d 18h
Merged PRs (30d)
3

Description

DefaultOrdering.moveObjectsByDelta calls notifyContainerModified(self.context), so all moveObjects* / moveObjectToPosition paths emit IContainerModifiedEvent. orderObjects (sort by key or reverse) mutates the same order annotation but fires nothing. Same in PartialOrdering.

Together with OFS (_setObject/_delObject, CopySupport) this makes orderObjects the only ordering mutation that subscribers cannot observe. Anything that mirrors folder order externally misses these changes; concrete case: plone.pgcatalog keeps stored getObjPositionInParent values in sync via an IContainerModifiedEvent subscriber (see https://github.com/bluedynamics/plone-pgcatalog/issues/216).

Proposal: call notifyContainerModified(self.context) at the end of orderObjects when the order was touched, in both implementations. Happy to send a PR.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating DefaultOrdering and PartialOrdering and reading their orderObjects implementations alongside moveObjectsByDelta, which already calls notifyContainerModified. Check the existing ordering tests or add coverage for both implementations, then verify that orderObjects emits IContainerModifiedEvent only when the order changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.