replaced some "for x in list …" v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 01 Mar 2010 02:31:03 +0000
branchv0.6.x
changeset 223 5c7b7cbb01cd
parent 222 d0c16e70a9fb
child 224 7e9874a50d92
replaced some "for x in list …"
VirtualMailManager/Alias.py
VirtualMailManager/Handler.py
VirtualMailManager/ext/Postconf.py
--- a/VirtualMailManager/Alias.py	Sun Feb 28 20:51:34 2010 +0000
+++ b/VirtualMailManager/Alias.py	Mon Mar 01 02:31:03 2010 +0000
@@ -43,9 +43,7 @@
                     self._gid, self._addr.localpart)
         dests = iter(dbc.fetchall())
         if dbc.rowcount > 0:
-            dest_add = self._dests.append
-            for dest in dests:
-                dest_add(EmailAddress(dest[0]))
+            self._dests.extend(EmailAddress(dest[0]) for dest in dests)
         dbc.close()
 
     def __check_expansion(self, count_new, limit):
--- a/VirtualMailManager/Handler.py	Sun Feb 28 20:51:34 2010 +0000
+++ b/VirtualMailManager/Handler.py	Mon Mar 01 02:31:03 2010 +0000
@@ -246,8 +246,8 @@
         """Creates a subscriptions file with the mailboxes from `folderlist`"""
         fname = os.path.join(self._Cfg.dget('maildir.name'), 'subscriptions')
         sf = open(fname, 'w')
-        for f in folderlist:
-            sf.write('%s\n' % f)
+        sf.write('\n'.join(folderlist))
+        sf.write('\n')
         sf.flush()
         sf.close()
         os.chown(fname, uid, gid)
--- a/VirtualMailManager/ext/Postconf.py	Sun Feb 28 20:51:34 2010 +0000
+++ b/VirtualMailManager/ext/Postconf.py	Mon Mar 01 02:31:03 2010 +0000
@@ -71,8 +71,7 @@
 
     def __readMulti(self, parameters):
         cmd = [self.__bin]
-        for parameter in parameters:
-            cmd.append(parameter[1:])
+        cmd.extend(parameter[1:] for parameter in parameters)
         out, err = Popen(cmd, stdout=PIPE, stderr=PIPE).communicate()
         if len(err):
             raise VMMError(err.strip(), ERR.VMM_ERROR)