src/pyams_content/shared/common/zmi/workflow.py
changeset 1077 24ab1360b343
parent 1049 6d6279200826
child 1185 944a3e4a78ab
--- 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')