# HG changeset patch # User Thierry Florac # Date 1512730096 -3600 # Node ID 8ffebf1c77c2c53f043f0720c69d22b73bc6f32e # Parent caa4dfcc51ee292d41000bfd1e821960b37925cb Added 'complete' argument to IWorkflowPublicationInfo.reset method to be able to keep previous push and publication end dates diff -r caa4dfcc51ee -r 8ffebf1c77c2 src/pyams_workflow/content.py --- a/src/pyams_workflow/content.py Mon Dec 04 15:26:42 2017 +0100 +++ b/src/pyams_workflow/content.py Fri Dec 08 11:48:16 2017 +0100 @@ -147,12 +147,13 @@ del IZopeDublinCore(self.__parent__)._mapping['Date.Expires'] self._publication_expiration_date = value - def reset(self): + def reset(self, complete=True): self._publication_date = None self._first_publication_date = None self._publication_effective_date = None - self._publication_expiration_date = None - self.push_end_date = None + if complete: + self._publication_expiration_date = None + self.push_end_date = None def is_published(self, check_parent=True): # check is parent is published @@ -228,4 +229,4 @@ @subscriber(IObjectClonedEvent, context_selector=IWorkflowPublicationSupport) def handle_cloned_publication_support(event): """Reset publication info when an object is cloned""" - IWorkflowPublicationInfo(event.object).reset() + IWorkflowPublicationInfo(event.object).reset(complete=False) diff -r caa4dfcc51ee -r 8ffebf1c77c2 src/pyams_workflow/interfaces/__init__.py --- a/src/pyams_workflow/interfaces/__init__.py Mon Dec 04 15:26:42 2017 +0100 +++ b/src/pyams_workflow/interfaces/__init__.py Fri Dec 08 11:48:16 2017 +0100 @@ -464,8 +464,12 @@ visible_publication_date = Attribute("Visible publication date") - def reset(self): - """Reset all publication info (used by clone features)""" + def reset(self, complete=True): + """Reset all publication info (used by clone features) + + If 'complete' argument is True, all date fields are reset; otherwise, push and publication end dates are + preserved in new versions. + """ def is_published(self, check_parent=True): """Is the content published?"""