(property, allow_parents=True)
Validate a case property name

    >>> validate_property('parent/maternal-grandmother_fullName')
    >>> validate_property('foo+bar')
    Traceback (most recent call last):
      ...
    ValueError: Invalid Property
Validate a case property name
Validate a case property name
def validate_property(property, allow_parents=True):
    """
    Validate a case property name

    >>> validate_property('parent/maternal-grandmother_fullName')
    >>> validate_property('foo+bar')
    Traceback (most recent call last):
      ...
    ValueError: Invalid Property

    """
    if allow_parents:
        # this regex is also copied in propertyList.ejs
        regex = r'^[a-zA-Z][\w_-]*(/[a-zA-Z][\w_-]*)*$'
    else:
        regex = r'^[a-zA-Z][\w_-]*$'
    if not re.match(regex, property):
        raise ValueError("Invalid Property")
def validate_property ( property , allow_parents = True ) : if allow_parents : # this regex is also copied in propertyList.ejs regex = r'^[a-zA-Z][\w_-]*(/[a-zA-Z][\w_-]*)*$' else : regex = r'^[a-zA-Z][\w_-]*$' if not re . match ( regex , property ) : raise ValueError ( "Invalid Property" )