dbus/python/_util.py
John (J5) Palmieri de689235e9 * python/_dbus.py, _util.py, decorators.py, extract.py, matchrules.py.
proxies.py, service.py: Cleanup of code after running it through the
  pyflakes code checker mostly dealing with undefined names.
  (Bug #3828, Patch from Anthony Baxter <anthony@interlink.com.au>)
2005-07-20 14:15:08 +00:00

13 lines
477 B
Python

import re
from exceptions import ValidationException
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))