diff --git a/datacenterlight/utils.py b/datacenterlight/utils.py index 8da408a0..b9edc994 100644 --- a/datacenterlight/utils.py +++ b/datacenterlight/utils.py @@ -89,8 +89,14 @@ def create_vm(billing_address_data, stripe_customer_id, specs, create_vm_task.delay(vm_template_id, user, specs, template, order.id) - for session_var in ['specs', 'template', 'billing_address', - 'billing_address_data', 'card_id', - 'token', 'customer']: - if session_var in request.session: - del request.session[session_var] + clear_all_session_vars(request) + + +def clear_all_session_vars(request): + if request.session is not None: + for session_var in ['specs', 'template', 'billing_address', + 'billing_address_data', 'card_id', + 'token', 'customer','generic_payment_type', + 'generic_payment_details', 'product_id']: + if session_var in request.session: + del request.session[session_var] \ No newline at end of file