From afb92f007bc4e74b0724a2e5791ce4b7fff1ff6e Mon Sep 17 00:00:00 2001
From: Jay
Date: Sun, 7 Apr 2019 23:59:45 -0400
Subject: Juntando ifs redundantes en post.py
---
cgi/manage.py | 2 +-
cgi/weabot.py | 12 +++---------
2 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/cgi/manage.py b/cgi/manage.py
index 4361f98..496ae30 100644
--- a/cgi/manage.py
+++ b/cgi/manage.py
@@ -410,7 +410,7 @@ def manage(self, path_split):
board = setBoard(oldboardid)
oldboard = board['dir']
oldboardsubject = board['subject']
- oldboardname = board['anonymous']
+ oldboardname = random.choice(board["anonymous"].split('|'))
# get old posts
posts = FetchAll("SELECT * FROM `posts` WHERE (`id` = {0} OR `parentid` = {0}) AND `boardid` = {1} ORDER BY id ASC".format(oldthread, board['id']))
diff --git a/cgi/weabot.py b/cgi/weabot.py
index 8d352a7..a02777f 100755
--- a/cgi/weabot.py
+++ b/cgi/weabot.py
@@ -474,12 +474,6 @@ class weabot(object):
if ball:
post["message"] += '
' + magic_ball()
- # remove sage from wrong fields
- if post["name"].lower() == 'sage':
- post["name"] = random.choice(board["anonymous"].split('|'))
- if post["subject"].lower() == 'sage':
- post["subject"] = board["subject"]
-
if not post["parentid"] and post["email"].lower() == 'sage':
post["email"] = ""
@@ -586,10 +580,10 @@ class weabot(object):
if file and board['allow_images'] == '0':
raise UserError, _("No images allowed.")
- # use default values when missing
- if not post["name"] and not post["tripcode"]:
+ # use default values when missing / remove sage from wrong fields
+ if (not post["name"] and not post["tripcode"]) or (post["name"].lower() == 'sage'):
post["name"] = random.choice(board["anonymous"].split('|'))
- if not post["subject"] and not post["parentid"]:
+ if (not post["subject"] and not post["parentid"]) or (post["subject"].lower() == 'sage'):
post["subject"] = board["subject"]
if not post["message"]:
post["message"] = board["message"]
--
cgit v1.2.1-18-gbd029