Index: /pykota/trunk/pykota/storages/sql.py
===================================================================
--- /pykota/trunk/pykota/storages/sql.py (revision 2749)
+++ /pykota/trunk/pykota/storages/sql.py (revision 2754)
@@ -376,7 +376,14 @@
         if result :
             patterns = printerpattern.split(",")
+            try :
+                patdict = {}.fromkeys(patterns)
+            except AttributeError :    
+                # Python v2.2 or earlier
+                patdict = {}
+                for p in patterns :
+                    patdict[p] = None
             for record in result :
                 pname = self.databaseToUserCharset(record["printername"])
-                if self.tool.matchString(pname, patterns) :
+                if patdict.has_key(pname) or self.tool.matchString(pname, patterns) :
                     printer = StoragePrinter(self, pname)
                     printer.ident = record.get("id")
@@ -404,7 +411,14 @@
         if result :
             patterns = userpattern.split(",")
+            try :
+                patdict = {}.fromkeys(patterns)
+            except AttributeError :    
+                # Python v2.2 or earlier
+                patdict = {}
+                for p in patterns :
+                    patdict[p] = None
             for record in result :
                 uname = self.databaseToUserCharset(record["username"])
-                if self.tool.matchString(uname, patterns) :
+                if patdict.has_key(uname) or self.tool.matchString(uname, patterns) :
                     user = StorageUser(self, uname)
                     user.ident = record.get("id")
@@ -429,7 +443,14 @@
         if result :
             patterns = grouppattern.split(",")
+            try :
+                patdict = {}.fromkeys(patterns)
+            except AttributeError :    
+                # Python v2.2 or earlier
+                patdict = {}
+                for p in patterns :
+                    patdict[p] = None
             for record in result :
                 gname = self.databaseToUserCharset(record["groupname"])
-                if self.tool.matchString(gname, patterns) :
+                if patdict.has_key(gname) or self.tool.matchString(gname, patterns) :
                     group = StorageGroup(self, gname)
                     group.ident = record.get("id")
Index: /pykota/trunk/pykota/storages/ldapstorage.py
===================================================================
--- /pykota/trunk/pykota/storages/ldapstorage.py (revision 2753)
+++ /pykota/trunk/pykota/storages/ldapstorage.py (revision 2754)
@@ -694,7 +694,14 @@
         if result :
             patterns = printerpattern.split(",")
+            try :
+                patdict = {}.fromkeys(patterns)
+            except AttributeError :    
+                # Python v2.2 or earlier
+                patdict = {}
+                for p in patterns :
+                    patdict[p] = None
             for (printerid, fields) in result :
                 printername = self.databaseToUserCharset(fields.get("pykotaPrinterName", [""])[0] or fields.get(self.info["printerrdn"], [""])[0])
-                if self.tool.matchString(printername, patterns) :
+                if patdict.has_key(printername) or self.tool.matchString(printername, patterns) :
                     printer = StoragePrinter(self, printername)
                     printer.ident = printerid
@@ -723,7 +730,14 @@
         if result :
             patterns = userpattern.split(",")
+            try :
+                patdict = {}.fromkeys(patterns)
+            except AttributeError :    
+                # Python v2.2 or earlier
+                patdict = {}
+                for p in patterns :
+                    patdict[p] = None
             for (userid, fields) in result :
                 username = self.databaseToUserCharset(fields.get("pykotaUserName", [""])[0] or fields.get(self.info["userrdn"], [""])[0])
-                if self.tool.matchString(username, patterns) :
+                if patdict.has_key(username) or self.tool.matchString(username, patterns) :
                     user = StorageUser(self, username)
                     user.ident = userid
@@ -781,7 +795,14 @@
         if result :
             patterns = grouppattern.split(",")
+            try :
+                patdict = {}.fromkeys(patterns)
+            except AttributeError :    
+                # Python v2.2 or earlier
+                patdict = {}
+                for p in patterns :
+                    patdict[p] = None
             for (groupid, fields) in result :
                 groupname = self.databaseToUserCharset(fields.get("pykotaGroupName", [""])[0] or fields.get(self.info["grouprdn"], [""])[0])
-                if self.tool.matchString(groupname, patterns) :
+                if patdict.has_key(groupname) or self.tool.matchString(groupname, patterns) :
                     group = StorageGroup(self, groupname)
                     group.ident = groupid
