Draft Buster
It’s really a bad thing that this engine does not save article without checking Draft checkbox. It may be an error in configuration on my part, but I have to create something that will make it easier for me to publish things. I created a script (see jump) that will regularly update drafts into published items once (DATE) is reached.
Here is the scriptt:
from datetime import datetime
import psycopg2
try:
date = datetime.now()
conn = psycopg2.connect(host="localhost",
user=DATABASE_USER,
password=DATABASE_PASSWORD,
database=DATABASE_NAME)
cursor = conn.cursor()
try:
cursor.execute("UPDATE blog_post SET is_draft=false WHERE is_draft=true and date <= '%s'" % (date.__str__()))
conn.commit()
except Exception as e:
print "There are some errors: (%s)" % (e)
except Exception as e:
print "Unable to connect using your settings (%s)" % (e)
exit
And here is the cron tab
* * * * * cd /path/to/blog/instance;python release_drafts.py
Comments
Comment form for «Draft Buster»