(slug, item, namespace=None)
Given a toggle and a username, whether the toggle is enabled for that user
Given a toggle and a username, whether the toggle is enabled for that user
Given a toggle and a username whether the toggle is enabled for that user
def toggle_enabled(slug, item, namespace=None):
    """
    Given a toggle and a username, whether the toggle is enabled for that user
    """
    from corehq.toggles import NAMESPACE_EMAIL_DOMAIN
    if namespace == NAMESPACE_EMAIL_DOMAIN and '@' in item:
        item = item.split('@')[-1]

    item = namespaced_item(item, namespace)
    if not settings.UNIT_TESTING or getattr(settings, 'DB_ENABLED', True):
        toggle = Toggle.cached_get(slug)
        return item in toggle.enabled_users if toggle else False
def toggle_enabled ( slug , item , namespace = None ) : from corehq . toggles import NAMESPACE_EMAIL_DOMAIN if namespace == NAMESPACE_EMAIL_DOMAIN and '@' in item : item = item . split ( '@' ) [ - 1 ] item = namespaced_item ( item , namespace ) if not settings . UNIT_TESTING or getattr ( settings , 'DB_ENABLED' , True ) : toggle = Toggle . cached_get ( slug ) return item in toggle . enabled_users if toggle else False