diff options
Diffstat (limited to 'python/_util.py')
| -rw-r--r-- | python/_util.py | 12 | 
1 files changed, 12 insertions, 0 deletions
diff --git a/python/_util.py b/python/_util.py new file mode 100644 index 00000000..3f7061c3 --- /dev/null +++ b/python/_util.py @@ -0,0 +1,12 @@ +import re + +def _validate_interface_or_name(value): +    elements = value.split('.') +    if len(elements) <= 1: +        raise ValidationException("%s must contain at least two elements seperated by a period ('.')"%(value)) + +    validate = re.compile('[A-Za-z][\w_]*') +    for element in elements: +        if not validate.match(element): +            raise ValidationException("Element %s of %s has invalid characters"%(element ,value)) +  | 
