diff --git a/CHANGES.rst b/CHANGES.rst index 4d61c82a..97e35f58 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -14,7 +14,8 @@ New features: Bug fixes: -- *add item here* +- Fix error when copying DX containers with AT children which caused the + children to not have the UID updated properly. [jone] 2.2.7 (2016-05-05) diff --git a/plone/dexterity/content.py b/plone/dexterity/content.py index 167a3edc..1222064f 100644 --- a/plone/dexterity/content.py +++ b/plone/dexterity/content.py @@ -221,6 +221,22 @@ def _verifyObjectPaste(self, obj, validate_src=True): 'You can not add the copied content here.' ) + def _getCopy(self, container): + # Copy the _v_is_cp and _v_cp_refs flags from the original + # object (self) to the new copy. + # This has impact on how children will be handled. + # When the flags are missing, an Archetypes child object will not have + # the UID updated in some situations. + # Copied from Products.Archetypes.Referenceable.Referenceable._getCopy + is_cp_flag = getattr(self, '_v_is_cp', None) + cp_refs_flag = getattr(self, '_v_cp_refs', None) + ob = super(PasteBehaviourMixin, self)._getCopy(container) + if is_cp_flag: + setattr(ob, '_v_is_cp', is_cp_flag) + if cp_refs_flag: + setattr(ob, '_v_cp_refs', cp_refs_flag) + return ob + @implementer( IDexterityContent,