Skip to content

Commit

Permalink
Add approved commenters
Browse files Browse the repository at this point in the history
  • Loading branch information
spudooli committed Oct 6, 2022
1 parent 764b4ed commit 6aa7663
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions spudoolicom/photoblog.py
Expand Up @@ -124,13 +124,19 @@ def post(id):
commentemail = request.form["commentemail"]
commentdate = datetime.now()
if "thesis" in commenturl:
flash("We got your comment, we'll consider publishing it in due course")
flash("Sod off spammer")
elif id == "110" or id == "66" or id == "348":
flash("We got your comment, we'll consider publishing it in due course")
flash("Sod off spammer")
else:
cur = db.mysql.connection.cursor()
cur.execute("select email from approved_commenter where email = %s", (commentemail,))
approved = cursor.fetchone()
if approved == None:
publishcomment = "no"
else:
publishcomment = "yes"
cur.execute("INSERT INTO pixelpost_comments (parent_id, message, name, url, email, datetime, publish) VALUES (%s, %s, %s, %s, %s, %s, %s)",
(id, commentmessage, commentname, commenturl, commentemail, commentdate, "no"))
(id, commentmessage, commentname, commenturl, commentemail, commentdate, publishcomment))
db.mysql.connection.commit()
cur.close()

Expand Down

0 comments on commit 6aa7663

Please sign in to comment.