The Random Ramblings

lost? dazed? confused? dont come here then as this aint goona help!!

To Cron or to Index or how should I get future posts to publish

Away from the films, something technical for once<br>rnSo, if you have read some of the past posts, you will know that I have dumped wordpress, actually dumped all commonly known CMS and I have written my own. If you didn't know that, just a little bit of detail

Wordpress is worse that it was when first released, bloated and horrible and removes all control from the blog owner. I was(am) learning Flask, a python web framework, so needed a project. What would make the perfect project, a CMS. The perfect way to eat your own dog food...

It's there on github for everyone to see, can't remember what Licence I gave it and I don't currently have an internet connection to be able to check but basically grab it if you want. If you know anything about programming, you will know that its pretty ugly code, as I said, learning, but its there for you.

So its there, you're reading this post on it and as far as being a blogging platform goes it certainly ticks the box of passing MVP, I can login, I can type stuff in and then I can publish it to the web for you, my dear blog followers, to read. Its certainly not perfect, and there are lots of things that I know it needs and that are still very much broken, the admin page being one of those things.

One of those things, the whole reason for the post and what's in the title, is what is going to be the best way to actually take a post that is marked for publishing at a certain point and actually make that appear on the site?

A bit of back information, how the publishing works currently, you tick the publish box and it gets shown on the site. That tick box is because I know that you might want to long term work on a post, you don't always get to finish it in one got so coming back later to continue working later is required. It's not quite implemented yet but I know that its on the list. The date that you can see on the post is applied in one of two ways. You can type in the date that you want to have displayed (YYYY/MM/DD hh:mm:ss) be that past, present or future and thats what gets shown. If you choose to ignore that the system takes the current time and injects that in there for you. Basically its that just to create a sort order for the posts and was also to allow me to add in the posts in the correct order when I migrated from wordpress.

So this leaves me with a few choices on future publishing. The published bool needs to be there, just so we can build drafts, thats already filtered on. Date would make the most sensible choice, remember this is a replacement for wordpress so I don't want the crazy date stuff they have, to decide on showing or not. The big question is how?

Now I think writing this post has been the equivalent of the rubber duck conversation and I think I have the most sensible way but I would still like other opinions. Here are they two ways that I think make the most sense

Create a show filter that only shows items that have a date less than now

Run a cron job, as part of the application, that changes some other column, that is the defacto published column

Each has pros and cons, one requires more work from the database but would that ever become an issue on a small blog like this? How many posts would it require before it became a problem and would dropping an index on that column expand it even further without issues? The advantage is that it is all contained in the app, and will show you the post the exact time that you asked for it to be shown.

The second sits outside the app but will not require any great functionality change in displaying the page. The published bool is index already and also a simple compare in comparison

So both could work both should be good but which one, if either is right? Let me know what you think, email, twitter or whatever you can use to speak to me...

Find Me
Javascript learning