summaryrefslogtreecommitdiff
path: root/python/_util.py
blob: 3f7061c3f9403807dfff5beda7e7df92bce2b440 (plain)
1
2
3
4
5
6
7
8
9
10
11
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))