Esempio n. 1
0
def get_enabled_features(event):
    """Returns a set of enabled feature names for an event"""
    enabled_features = features_event_settings.get(event, 'enabled')
    if enabled_features is not None:
        return set(enabled_features)
    else:
        return {name for name, feature in get_feature_definitions().iteritems() if feature.is_default_for_event(event)}
Esempio n. 2
0
def get_enabled_features(event, only_explicit=False):
    """Returns a set of enabled feature names for an event"""
    enabled_features = features_event_settings.get(event, 'enabled')
    if enabled_features is not None:
        return set(enabled_features)
    elif only_explicit:
        return set()
    else:
        return {
            name
            for name, feature in get_feature_definitions().iteritems()
            if feature.is_default_for_event(event)
        }
Esempio n. 3
0
def is_feature_enabled(event, name):
    """Checks if a feature is enabled for an event.

    :param event: The event (or event ID) to check.
    :param name: The name of the feature.
    """
    from MaKaC.conference import ConferenceHolder
    feature = get_feature_definition(name)
    enabled_features = features_event_settings.get(event, 'enabled')
    if enabled_features is not None:
        return feature.name in enabled_features
    else:
        with DBMgr.getInstance().global_connection():
            if isinstance(event, (basestring, int, long)):
                event = ConferenceHolder().getById(event, True)
            return event and feature.is_default_for_event(event)
Esempio n. 4
0
def is_feature_enabled(event, name):
    """Checks if a feature is enabled for an event.

    :param event: The event (or event ID) to check.
    :param name: The name of the feature.
    """
    from MaKaC.conference import ConferenceHolder
    feature = get_feature_definition(name)
    enabled_features = features_event_settings.get(event, 'enabled')
    if enabled_features is not None:
        return feature.name in enabled_features
    else:
        with DBMgr.getInstance().global_connection():
            if isinstance(event, (basestring, int, long)):
                event = ConferenceHolder().getById(event, True)
            return event and feature.is_default_for_event(event)