

def validate_attribute(self, attr_name):
    '\n        Finds out whether or not given sqlalchemy model attribute name is\n        valid. Returns attribute property if valid.\n\n        :param attr_name: Attribute name\n        '
    try:
        attr = getattr(self.model_class, attr_name)
    except AttributeError:
        try:
            translation_class = self.model_class.__translatable__['class']
            attr = getattr(translation_class, attr_name)
        except AttributeError:
            if self.meta.attr_errors:
                raise InvalidAttributeException(attr_name)
            else:
                return (None, None)
    try:
        if (not isinstance(attr_name.property, ColumnProperty)):
            if self.meta.attr_errors:
                raise InvalidAttributeException(attr_name)
            else:
                return (None, None)
    except AttributeError:
        raise AttributeTypeException(attr_name)
    return (attr_name, attr.property)

dataset/ETHPy150Open kvesteri/wtforms-alchemy/wtforms_alchemy/generator.py FormGenerator.validate_attribute/VarMisuse@104/197 `attr`->`attr_name`