514 from Domain import search |
514 from Domain import search |
515 like = False |
515 like = False |
516 if pattern is not None: |
516 if pattern is not None: |
517 if pattern.startswith('%') or pattern.endswith('%'): |
517 if pattern.startswith('%') or pattern.endswith('%'): |
518 like = True |
518 like = True |
519 if pattern.startswith('%') and pattern.endswith('%'): |
519 domain = pattern.strip('%') |
520 domain = pattern[1:-1] |
|
521 elif pattern.startswith('%'): |
|
522 domain = pattern[1:] |
|
523 elif pattern.endswith('%'): |
|
524 domain = pattern[:-1] |
|
525 if not re.match(RE_DOMAIN_SRCH, domain): |
520 if not re.match(RE_DOMAIN_SRCH, domain): |
526 raise VMMError( |
521 raise VMMError( |
527 _(u"The pattern ā%sā contains invalid characters.") % |
522 _(u"The pattern '%s' contains invalid characters.") % |
528 pattern, ERR.DOMAIN_INVALID) |
523 pattern, ERR.DOMAIN_INVALID) |
529 self.__dbConnect() |
524 self.__dbConnect() |
530 return search(self._dbh, pattern=pattern, like=like) |
525 return search(self._dbh, pattern=pattern, like=like) |
531 |
526 |
532 def userAdd(self, emailaddress, password): |
527 def userAdd(self, emailaddress, password): |