From 0f8da38844f3238740e3d00e8dd39bc35810e23a Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 13 Jan 2020 11:36:42 +0000 Subject: [PATCH] Set published date on scheduled posts --- schedule.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/schedule.py b/schedule.py index 962a36eef..310e4e2ae 100644 --- a/schedule.py +++ b/schedule.py @@ -9,6 +9,7 @@ __status__ = "Production" import os import time import datetime +from utils import getStatusNumber from utils import loadJson from outbox import postMessageToOutbox @@ -76,6 +77,17 @@ def updatePostSchedule(baseDir: str,handle: str,httpd,maxScheduledPosts: int) -> indexLines.remove(line) continue + # set the published time + # If this is not recent then http checks on the receiving side + # will reject it + statusNumber,published = getStatusNumber() + if postJsonObject.get('published'): + postJsonObject['published']=published + if postJsonObject.get('object'): + if isinstance(postJsonObject['object'], dict): + if postJsonObject['object'].get('published'): + postJsonObject['published']=published + print('Sending scheduled post '+postId) if not postMessageToOutbox(postJsonObject,nickname, \ @@ -96,6 +108,7 @@ def updatePostSchedule(baseDir: str,handle: str,httpd,maxScheduledPosts: int) -> httpd.projectVersion, \ httpd.debug): indexLines.remove(line) + os.remove(postFilename) continue # move to the outbox