Small optimizations in Account.getAliases() and Alias.getInfo().
authorPascal Volk <neverseen@users.sourceforge.net>
Sat, 05 Sep 2009 18:46:33 +0000
changeset 144 4c6aa6c29dd7
parent 143 16542519a5a8
child 145 ead2a7e9f8be
Small optimizations in Account.getAliases() and Alias.getInfo().
VirtualMailManager/Account.py
VirtualMailManager/Alias.py
--- a/VirtualMailManager/Account.py	Sat Sep 05 18:01:04 2009 +0000
+++ b/VirtualMailManager/Account.py	Sat Sep 05 18:46:33 2009 +0000
@@ -210,8 +210,7 @@
         dbc.close()
         aliases = []
         if len(addresses) > 0:
-            for alias in addresses:
-                aliases.append(alias[0])
+            aliases = [alias[0] for alias in addresses]
         return aliases
 
     def delete(self, delalias):
--- a/VirtualMailManager/Alias.py	Sat Sep 05 18:01:04 2009 +0000
+++ b/VirtualMailManager/Alias.py	Sat Sep 05 18:46:33 2009 +0000
@@ -96,9 +96,7 @@
         destinations = dbc.fetchall()
         dbc.close()
         if len(destinations) > 0:
-            targets = []
-            for destination in destinations:
-                targets.append(destination[0])
+            targets = [destination[0] for destination in destinations]
             return targets
         else:
             raise VMMAE(_(u"The alias ā€œ%sā€ doesn't exists.") % self._addr,