Esempio n. 1
0
def __validate1(property):
    """ Exit with error if property is not valid.
    """
    msg = None

    if not property.feature().free():
        feature.validate_value_string(property.feature(), property.value())
Esempio n. 2
0
def __validate1(property):
    """ Exit with error if property is not valid.
    """
    msg = None

    if not property.feature().free():
        feature.validate_value_string(property.feature(), property.value())
Esempio n. 3
0
def __validate1 (property):
    """ Exit with error if property is not valid.
    """        
    msg = None

    f = get_grist (property)
    if f:
        value = get_value (property)

        if not feature.valid (f):
            f = ungrist (get_grist (property)) # Ungrist for better error messages
            msg = "Unknown feature '%s'" % f

        elif value and not 'free' in feature.attributes (f):
            feature.validate_value_string (f, value)

        elif not value:
            f = ungrist (get_grist (property)) # Ungrist for better error messages
            msg = "No value specified for feature '%s'" % f

    else:
        f = feature.implied_feature (property)
        feature.validate_value_string (f, property)

    if msg:
        # FIXME: don't use globals like this. Import here to
        # break circular dependency.
        from b2.manager import get_manager
        get_manager().errors()("Invalid property '%s': %s" % (property, msg))
Esempio n. 4
0
def __validate1 (property):
    """ Exit with error if property is not valid.
    """
    assert isinstance(property, Property)
    msg = None

    if not property.feature.free:
        feature.validate_value_string (property.feature, property.value)
Esempio n. 5
0
def __validate1(property):
    """ Exit with error if property is not valid.
    """
    assert isinstance(property, Property)
    msg = None

    if not property.feature.free:
        feature.validate_value_string(property.feature, property.value)