# HG changeset patch # User Thierry Florac # Date 1542021385 -3600 # Node ID 24ab1360b343cbbb217e28f366760fd4d6136c00 # Parent 93f78438ff8c264a8d4d0218d05d35fd661ef30c Set publication effective date in publication form if missing diff -r 93f78438ff8c -r 24ab1360b343 src/pyams_content/shared/common/zmi/workflow.py --- a/src/pyams_content/shared/common/zmi/workflow.py Mon Nov 12 12:07:52 2018 +0100 +++ b/src/pyams_content/shared/common/zmi/workflow.py Mon Nov 12 12:16:25 2018 +0100 @@ -327,10 +327,12 @@ super(PublicationForm, self).updateWidgets(prefix) pub_info = IWorkflowPublicationInfo(self.context) if 'publication_effective_date' in self.widgets: - self.widgets['publication_effective_date'].required = True + widget = self.widgets['publication_effective_date'] + widget.required = True if pub_info.publication_effective_date: - self.widgets['publication_effective_date'].value = \ - tztime(pub_info.publication_effective_date).strftime('%d/%m/%y %H:%M') + widget.value = tztime(pub_info.publication_effective_date).strftime('%d/%m/%y %H:%M') + else: + widget.value = tztime(datetime.utcnow()).strftime('%d/%m/%y %H:%M') if ('push_end_date' in self.widgets) and pub_info.push_end_date: self.widgets['push_end_date'].value = \ tztime(pub_info.push_end_date).strftime('%d/%m/%y %H:%M')