traffic.py: avoid inefficient string concatenations
authorBjörn Jacke <bj@sernet.de>
Sun, 25 Aug 2019 21:04:25 +0000 (23:04 +0200)
committerBjoern Jacke <bjacke@samba.org>
Tue, 24 Sep 2019 12:22:44 +0000 (12:22 +0000)
Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/emulate/traffic.py

index d0a2ffc8f2cebbcdbf7b2d79aa85a15efb28101d..c428b4e369eb48f9d256650ea10f890de22a4835 100644 (file)
@@ -453,9 +453,7 @@ class ReplayContext(object):
         # lookup all the GPO DNs
         res = db.search(db.domain_dn(), scope=ldb.SCOPE_SUBTREE, attrs=['dn'],
                         expression='(objectclass=groupPolicyContainer)')
-        gpos_by_dn = ""
-        for msg in res:
-            gpos_by_dn += "(distinguishedName={0})".format(msg['dn'])
+        gpos_by_dn = "".join("(distinguishedName={0})".format(msg['dn']) for msg in res)
 
         # a search for the 'gPCFileSysPath' attribute is probably a GPO search
         # (as per the MS-GPOL spec) which searches for GPOs by DN