Skip to content

Conversation

@drfho
Copy link
Contributor

@drfho drfho commented Jan 5, 2026

On activated workflow copy/paste-inserted objects shall not be visible. That is why the get the status "NEW". If pageelements are inserted into a page, the current page-node shall get the status changed, and the new pagelements the status "NEW". If a document (tree) is inserted the inserted page-like objects shall get the status "NEW" to prevent them being published instantly. The pages subordinated pageelements are not set to "NEW" because

  1. their page is "NEW" (=invisble) and thus their pagelements are not invisible
  2. removing status "NEW" from all subordinated pageelements individually by changing/saving them to "MODIFIED" would be unproductive

Hint: This STATUS_NEW settting does not happen if the workflow is deaktivated; here the copied nodes are instantly visible.

Moreover the code change tries to add some Py best practices:

  1. Avoid mutable default arguments.
  2. Reduce code nesting for readability.
  3. Use helper functions for repeated logic.
  4. Follow PEP8 for indentation and naming.

The function normalize_ids_after_copy() gets 2. more parameter (is_initial_node=True, processed_nodes=None) to differ the recursion-case (tree-inserting) and avoid multiple onObjChange-events.


References:

  1. 7aaec72
  2. normalize_ids_after_copy(): Avoid Repetitive Indexing and Collateral Renaming #404
  3. https://github.com/idasm-unibe-ch/unibe-cms/pull/952#issuecomment-2909300928
  4. https://github.com/sntl-projects/neon/issues/43

@zmsdev
Copy link
Contributor

zmsdev commented Jan 19, 2026

@drfho
I would suggest the following alternative with custom events for the copied/moved objects:
https://github.com/zms-publishing/ZMS/compare/fb_normalize_ids_after_copy?expand=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants