aboutsummaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorLibravatar Jay 2019-04-07 23:59:45 -0400
committerLibravatar Jay 2019-04-08 00:01:38 -0400
commitafb92f007bc4e74b0724a2e5791ce4b7fff1ff6e (patch)
treebb6a75d369ac309c0db7d2b7eb865f5568670487 /cgi
parent4f3a808222e124b2462da9be6407f77e2092a89e (diff)
downloadweabot-afb92f007bc4e74b0724a2e5791ce4b7fff1ff6e.tar.gz
weabot-afb92f007bc4e74b0724a2e5791ce4b7fff1ff6e.tar.xz
weabot-afb92f007bc4e74b0724a2e5791ce4b7fff1ff6e.zip
Juntando ifs redundantes en post.py
Diffstat (limited to 'cgi')
-rw-r--r--cgi/manage.py2
-rwxr-xr-xcgi/weabot.py12
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"] += '<hr />' + 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"]