From 55f96d0ccb9bede2d457cbdb817a8e824618c449 Mon Sep 17 00:00:00 2001 From: Arkadii Yakovets Date: Mon, 19 Feb 2024 08:09:15 -0800 Subject: [PATCH] Do not use `==` for boolean comparisons --- blt/settings.py | 2 +- website/views.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/blt/settings.py b/blt/settings.py index 814fa42a5a..c5cb9e04b2 100644 --- a/blt/settings.py +++ b/blt/settings.py @@ -370,7 +370,7 @@ if not os.path.exists(AVATAR_PATH): os.makedirs(AVATAR_PATH) -if DEBUG == True or TESTING: +if DEBUG or TESTING: CACHES = {"default": {"BACKEND": "django.core.cache.backends.locmem.LocMemCache"}} else: if os.environ.get("MEMCACHIER_SERVERS", ""): diff --git a/website/views.py b/website/views.py index 28f71fa172..a59b28e9fe 100644 --- a/website/views.py +++ b/website/views.py @@ -572,7 +572,7 @@ def process_issue(self, user, obj, created, domain, tokenauth=False, score=3): name = "support" domain.email = email_to domain.save() - if tokenauth == False: + if not tokenauth: msg_plain = render_to_string( "email/bug_added.txt", { @@ -1197,7 +1197,7 @@ def delete_issue(request, id): if request.user.is_superuser or request.user == issue.user: issue.delete() messages.success(request, "Issue deleted") - if tokenauth == True: + if tokenauth: return JsonResponse("Deleted", safe=False) else: return redirect("/") @@ -3096,7 +3096,7 @@ def withdraw(request): stripe.api_key = settings.STRIPE_TEST_SECRET_KEY if wallet.account_id: account = stripe.Account.retrieve(wallet.account_id) - if account.payouts_enabled == True: + if account.payouts_enabled: balance = stripe.Balance.retrieve() if balance.available[0].amount > payment.value * 100: stripe.Transfer.create( @@ -3179,7 +3179,7 @@ def stripe_connected(request, username): stripe.api_key = settings.STRIPE_TEST_SECRET_KEY account = stripe.Account.retrieve(wallet.account_id) - if account.payouts_enabled == True: + if account.payouts_enabled: payment = Payment.objects.get(wallet=wallet, active=True) balance = stripe.Balance.retrieve() if balance.available[0].amount > payment.value * 100: @@ -3780,10 +3780,10 @@ def get_context_data(self, **kwargs): # if word.lower() == "type": # flag_word = True # continue -# if flag_word == False: +# if not flag_word: # url = word # continue -# if flag_word == True: +# if flag_word: # label = word # if part.get_content_maintype() == "multipart": # continue @@ -3815,9 +3815,9 @@ def get_context_data(self, **kwargs): # error = True # if token == "None": # error = "TokenTrue" -# if image == False: +# if not image: # error = True -# if error == True: +# if error: # send_mail( # "Error In Your Report", # "There was something wrong with the mail you sent regarding the issue to be created. Please check the content and try again later !",