VirtualMailManager/handler.py
branchv0.7.x
changeset 638 0de0b9e75c9f
parent 637 ca6621caff2f
child 643 df1e3b67882a
--- a/VirtualMailManager/handler.py	Sun Nov 04 18:33:11 2012 +0000
+++ b/VirtualMailManager/handler.py	Mon Nov 05 21:57:37 2012 +0000
@@ -615,10 +615,7 @@
                 dpattern = parts[1]
                 dlike = dpattern.startswith('%') or dpattern.endswith('%')
 
-                if llike:
-                    checkp = lpattern.strip('%')
-                else:
-                    checkp = lpattern
+                checkp = lpattern.strip('%') if llike else lpattern
                 if len(checkp) > 0 and re.search(RE_LOCALPART, checkp):
                     raise VMMError(_(u"The pattern '%s' contains invalid "
                                      u"characters.") % pattern,
@@ -629,10 +626,7 @@
                 dpattern = parts[0]
                 dlike = dpattern.startswith('%') or dpattern.endswith('%')
 
-            if dlike:
-                checkp = dpattern.strip('%')
-            else:
-                checkp = dpattern
+            checkp = dpattern.strip('%') if dlike else dpattern
             if len(checkp) > 0 and not re.match(RE_DOMAIN_SEARCH, checkp):
                 raise VMMError(_(u"The pattern '%s' contains invalid "
                                  u"characters.") % pattern, DOMAIN_INVALID)
@@ -855,10 +849,8 @@
         if not acc:
             raise VMMError(_(u"The account '%s' does not exist.") %
                            acc.address, NO_SUCH_ACCOUNT)
-        if transport == 'domain':
-            transport = None
-        else:
-            transport = Transport(self._dbh, transport=transport)
+        transport = None if transport == 'domain' \
+                         else Transport(self._dbh, transport=transport)
         acc.update_transport(transport)
 
     def user_services(self, emailaddress, *services):