(domain, new_plan_version)
Alert the user if there are currently custom roles set up for the domain.
Alert the user if there are currently custom roles set up for the domain.
Alert the user if there are currently custom roles set up for the domain .
def response_role_based_access(domain, new_plan_version):
        """
        Alert the user if there are currently custom roles set up for the domain.
        """
        custom_roles = [role.name for role in get_custom_roles_for_domain(domain.name)]
        num_roles = len(custom_roles)
        from corehq.apps.accounting.models import SoftwarePlanEdition
        if new_plan_version.plan.edition == SoftwarePlanEdition.PAUSED:
            # don't perform this downgrade for paused plans, as we don't want
            # users to lose their original role assignments when the plan is un-paused.
            return
        if num_roles > 0:
            return _fmt_alert(
                ungettext(
                    "You have %(num_roles)d Custom Role configured for your "
                    "project. If you select this plan, all users with that "
                    "role will change to having the Read Only role.",
                    "You have %(num_roles)d Custom Roles configured for your "
                    "project . If you select this plan, all users with these "
                    "roles will change to having the Read Only role.",
                    num_roles
                ) % {
                    'num_roles': num_roles,
                }, custom_roles)
def response_role_based_access ( domain , new_plan_version ) : custom_roles = [ role . name for role in get_custom_roles_for_domain ( domain . name ) ] num_roles = len ( custom_roles ) from corehq . apps . accounting . models import SoftwarePlanEdition if new_plan_version . plan . edition == SoftwarePlanEdition . PAUSED : # don't perform this downgrade for paused plans, as we don't want # users to lose their original role assignments when the plan is un-paused. return if num_roles > 0 : return _fmt_alert ( ungettext ( "You have %(num_roles)d Custom Role configured for your " "project. If you select this plan, all users with that " "role will change to having the Read Only role." , "You have %(num_roles)d Custom Roles configured for your " "project . If you select this plan, all users with these " "roles will change to having the Read Only role." , num_roles ) % { 'num_roles' : num_roles , } , custom_roles )