Flip the order of logging

This commit is contained in:
PCoder 2019-05-06 08:47:59 +02:00
parent a63d9098d4
commit 729a813804

View file

@ -89,33 +89,33 @@ class Command(BaseCommand):
# Delete Billing Address # Delete Billing Address
if order.billing_address is not None: if order.billing_address is not None:
order.billing_address.delete()
logger.debug( logger.debug(
"Billing Address {} associated with {} deleted" "Billing Address {} associated with {} deleted"
"".format(order.billing_address.id, email) "".format(order.billing_address.id, email)
) )
order.billing_address.delete()
else: else:
logger.error( logger.error(
"Error while deleting the billing_address") "Error while deleting the billing_address")
# Delete Order Detail # Delete Order Detail
if order.order_detail is not None: if order.order_detail is not None:
order.order_detail.delete()
logger.debug( logger.debug(
"Order Detail {} associated with {} deleted" "Order Detail {} associated with {} deleted"
"".format(order.order_detail.id, email) "".format(order.order_detail.id, email)
) )
order.order_detail.delete()
else: else:
logger.error( logger.error(
"Error while deleting the order_detail. None") "Error while deleting the order_detail. None")
# Delete order # Delete order
if order is not None: if order is not None:
order.delete()
logger.debug( logger.debug(
"Order {} associated with {} deleted" "Order {} associated with {} deleted"
"".format(order.id, email) "".format(order.id, email)
) )
order.delete()
else: else:
logger.error( logger.error(
"Error while deleting the Order") "Error while deleting the Order")
@ -127,21 +127,21 @@ class Command(BaseCommand):
# delete hosting bills # delete hosting bills
for bill in hosting_bills: for bill in hosting_bills:
if bill.billing_address is not None: if bill.billing_address is not None:
bill.billing_address.delete()
logger.debug( logger.debug(
"HostingBills billing address {} associated with {} deleted" "HostingBills billing address {} associated with {} deleted"
"".format(bill.billing_address.id, email) "".format(bill.billing_address.id, email)
) )
bill.billing_address.delete()
else: else:
logger.error( logger.error(
"Error while deleting the HostingBill's Billing address") "Error while deleting the HostingBill's Billing address")
if bill is not None: if bill is not None:
bill.delete()
logger.debug( logger.debug(
"HostingBill {} associated with {} deleted" "HostingBill {} associated with {} deleted"
"".format(bill.id, email) "".format(bill.id, email)
) )
bill.delete()
else: else:
logger.error( logger.error(
"Error while deleting the HostingBill") "Error while deleting the HostingBill")
@ -150,11 +150,11 @@ class Command(BaseCommand):
for vm_id in vm_ids: for vm_id in vm_ids:
vm_detail = VMDetail.objects.get(vm_id=vm_id) vm_detail = VMDetail.objects.get(vm_id=vm_id)
if vm_detail is not None: if vm_detail is not None:
vm_detail.delete()
logger.debug( logger.debug(
"vm_detail {} associated with {} deleted" "vm_detail {} associated with {} deleted"
"".format(vm_detail.id, email) "".format(vm_detail.id, email)
) )
vm_detail.delete()
else: else:
logger.error( logger.error(
"Error while deleting the vm_detail") "Error while deleting the vm_detail")
@ -165,11 +165,11 @@ class Command(BaseCommand):
) )
for ucd in ucds: for ucd in ucds:
if ucd is not None: if ucd is not None:
ucd.delete()
logger.debug( logger.debug(
"User Card Detail {} associated with {} deleted" "User Card Detail {} associated with {} deleted"
"".format(ucd.id, email) "".format(ucd.id, email)
) )
ucd.delete()
else: else:
logger.error( logger.error(
"Error while deleting the User Card Detail") "Error while deleting the User Card Detail")