VirtualMailManager/Handler.py
branchv0.6.x
changeset 237 09b7e3fe29b3
parent 236 084331dd1e4c
child 240 fb6336b25b8f
equal deleted inserted replaced
236:084331dd1e4c 237:09b7e3fe29b3
   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):