We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I write blog posts with pre-defined publishing dates. If this date is tomorrow, the publishing happens today, which is 1 day too early.
Create a post with tomorrow's date (example assumes that today is October the 5th):
.. post:: Oct 6, 2017 :title: this is a title
Build the sources ablog build
ablog build
The post is not published
The post is listed in the recent posts section
Recent posts ============ .. postlist:: 5 :excerpts: :date: %b %d, %Y :list-style: circle
The variable TOMORROW gets created with time, while the post.date is a datetime object without time. Examples: A print statement after this line https://github.com/abakan/ablog/blob/87933fa874680129986c5fff54518d83c753c07b/ablog/blog.py#L89
TOMORROW
post.date
print('TOMORROW = %s', TOMORROW) # added for debug
results in this output:
('TOMORROW = %s', datetime.datetime(2017, 10, 6, 7, 34, 2, 150817))
while the print statement after this comparison at https://github.com/abakan/ablog/blob/87933fa874680129986c5fff54518d83c753c07b/ablog/blog.py#L239
print('post date: %s', post.date) # added for debug
('post date: %s', datetime.datetime(2017, 10, 6, 0, 0))
In short, the post date of tomorrow will always be older than the TOMORROW variable.
This (ugly) diff shows one way to do it:
--- blog.py 2017-10-05 20:19:08.405927051 +0200 +++ blog.py.new 2017-10-05 20:10:42.842425856 +0200 @@ -87,6 +87,7 @@ TOMORROW = datetime.today() + dtmod.timedelta(1) +TOMORROW = TOMORROW.replace(hour=0, minute=0, second=0, microsecond=0) FUTURE = datetime(9999, 12, 31)
When we remove the time information of TOMORROW, the comparison works and a post for tomorrow gets only published tomorrow.
The text was updated successfully, but these errors were encountered:
Add private fix for ABlog issue 94
045f538
Blog posts with post dates for tomorrow get published today: abakan-zz/ablog#94 This change adds a private patch until it is fixed in ABlog.
A new version of Ablog (v0.9.0) is out at this repo.
We did take your fix!
Sorry, something went wrong.
No branches or pull requests
I write blog posts with pre-defined publishing dates. If this date is tomorrow, the publishing happens today, which is 1 day too early.
steps to reproduce
Create a post with tomorrow's date (example assumes that today is October the 5th):
Build the sources
ablog build
expected result
The post is not published
actual result
The post is listed in the recent posts section
root cause
The variable
TOMORROW
gets created with time, while thepost.date
is a datetime object without time. Examples:A print statement after this line https://github.com/abakan/ablog/blob/87933fa874680129986c5fff54518d83c753c07b/ablog/blog.py#L89
results in this output:
while the print statement after this comparison at https://github.com/abakan/ablog/blob/87933fa874680129986c5fff54518d83c753c07b/ablog/blog.py#L239
results in this output:
In short, the post date of tomorrow will always be older than the TOMORROW variable.
possible fix
This (ugly) diff shows one way to do it:
When we remove the time information of TOMORROW, the comparison works and a post for tomorrow gets only published tomorrow.
The text was updated successfully, but these errors were encountered: