(self, new_plan_version=None,
                                       downgraded_privileges=None,
                                       upgraded_privileges=None,
                                       old_subscription=None,
                                       new_subscription=None,
                                       internal_change=False)
downgraded_privileges is the list of privileges that should be removed
        upgraded_privileges is the list of privileges that should be added
downgraded_privileges is the list of privileges that should be removed
        upgraded_privileges is the list of privileges that should be added
downgraded_privileges is the list of privileges that should be removed upgraded_privileges is the list of privileges that should be added
def _apply_upgrades_and_downgrades(self, new_plan_version=None,
                                       downgraded_privileges=None,
                                       upgraded_privileges=None,
                                       old_subscription=None,
                                       new_subscription=None,
                                       internal_change=False):
        """
        downgraded_privileges is the list of privileges that should be removed
        upgraded_privileges is the list of privileges that should be added
        """
        if new_plan_version is None:
            new_plan_version = DefaultProductPlan.get_default_plan_version()

        if downgraded_privileges is None or upgraded_privileges is None:
            change_status_result = get_change_status(None, new_plan_version)
            downgraded_privileges = downgraded_privileges or change_status_result.downgraded_privs
            upgraded_privileges = upgraded_privileges or change_status_result.upgraded_privs

        if downgraded_privileges:
            Subscriber._process_downgrade(self.domain, downgraded_privileges, new_plan_version)

        if upgraded_privileges:
            Subscriber._process_upgrade(self.domain, upgraded_privileges, new_plan_version)

        if Subscriber.should_send_subscription_notification(old_subscription, new_subscription):
            send_subscription_change_alert(self.domain, new_subscription, old_subscription, internal_change)

        subscription_upgrade_or_downgrade.send_robust(None, domain=self.domain)
def _apply_upgrades_and_downgrades ( self , new_plan_version = None , downgraded_privileges = None , upgraded_privileges = None , old_subscription = None , new_subscription = None , internal_change = False ) : if new_plan_version is None : new_plan_version = DefaultProductPlan . get_default_plan_version ( ) if downgraded_privileges is None or upgraded_privileges is None : change_status_result = get_change_status ( None , new_plan_version ) downgraded_privileges = downgraded_privileges or change_status_result . downgraded_privs upgraded_privileges = upgraded_privileges or change_status_result . upgraded_privs if downgraded_privileges : Subscriber . _process_downgrade ( self . domain , downgraded_privileges , new_plan_version ) if upgraded_privileges : Subscriber . _process_upgrade ( self . domain , upgraded_privileges , new_plan_version ) if Subscriber . should_send_subscription_notification ( old_subscription , new_subscription ) : send_subscription_change_alert ( self . domain , new_subscription , old_subscription , internal_change ) subscription_upgrade_or_downgrade . send_robust ( None , domain = self . domain )