VMM/Handler: compressed Handler.domainList() and replaced “%s” with '%s' in v0.6.x
authorTobias Berling <mail@tobiasberling.de>
Sun, 04 Apr 2010 22:44:58 +0000
branchv0.6.x
changeset 237 09b7e3fe29b3
parent 236 084331dd1e4c
child 240 fb6336b25b8f
VMM/Handler: compressed Handler.domainList() and replaced “%s” with '%s' in error message.
VirtualMailManager/Handler.py
--- a/VirtualMailManager/Handler.py	Sun Apr 04 08:16:46 2010 +0000
+++ b/VirtualMailManager/Handler.py	Sun Apr 04 22:44:58 2010 +0000
@@ -516,15 +516,10 @@
         if pattern is not None:
             if pattern.startswith('%') or pattern.endswith('%'):
                 like = True
-                if pattern.startswith('%') and pattern.endswith('%'):
-                    domain = pattern[1:-1]
-                elif pattern.startswith('%'):
-                    domain = pattern[1:]
-                elif pattern.endswith('%'):
-                    domain = pattern[:-1]
+                domain = pattern.strip('%')
                 if not re.match(RE_DOMAIN_SRCH, domain):
                     raise VMMError(
-                    _(u"The pattern “%s” contains invalid characters.") %
+                    _(u"The pattern '%s' contains invalid characters.") %
                     pattern, ERR.DOMAIN_INVALID)
         self.__dbConnect()
         return search(self._dbh, pattern=pattern, like=like)