Changeset 2754
- Timestamp:
- 02/23/06 20:44:25 (19 years ago)
- Location:
- pykota/trunk/pykota/storages
- Files:
-
- 2 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/ldapstorage.py
r2753 r2754 694 694 if result : 695 695 patterns = printerpattern.split(",") 696 try : 697 patdict = {}.fromkeys(patterns) 698 except AttributeError : 699 # Python v2.2 or earlier 700 patdict = {} 701 for p in patterns : 702 patdict[p] = None 696 703 for (printerid, fields) in result : 697 704 printername = self.databaseToUserCharset(fields.get("pykotaPrinterName", [""])[0] or fields.get(self.info["printerrdn"], [""])[0]) 698 if self.tool.matchString(printername, patterns) :705 if patdict.has_key(printername) or self.tool.matchString(printername, patterns) : 699 706 printer = StoragePrinter(self, printername) 700 707 printer.ident = printerid … … 723 730 if result : 724 731 patterns = userpattern.split(",") 732 try : 733 patdict = {}.fromkeys(patterns) 734 except AttributeError : 735 # Python v2.2 or earlier 736 patdict = {} 737 for p in patterns : 738 patdict[p] = None 725 739 for (userid, fields) in result : 726 740 username = self.databaseToUserCharset(fields.get("pykotaUserName", [""])[0] or fields.get(self.info["userrdn"], [""])[0]) 727 if self.tool.matchString(username, patterns) :741 if patdict.has_key(username) or self.tool.matchString(username, patterns) : 728 742 user = StorageUser(self, username) 729 743 user.ident = userid … … 781 795 if result : 782 796 patterns = grouppattern.split(",") 797 try : 798 patdict = {}.fromkeys(patterns) 799 except AttributeError : 800 # Python v2.2 or earlier 801 patdict = {} 802 for p in patterns : 803 patdict[p] = None 783 804 for (groupid, fields) in result : 784 805 groupname = self.databaseToUserCharset(fields.get("pykotaGroupName", [""])[0] or fields.get(self.info["grouprdn"], [""])[0]) 785 if self.tool.matchString(groupname, patterns) :806 if patdict.has_key(groupname) or self.tool.matchString(groupname, patterns) : 786 807 group = StorageGroup(self, groupname) 787 808 group.ident = groupid -
pykota/trunk/pykota/storages/sql.py
r2749 r2754 376 376 if result : 377 377 patterns = printerpattern.split(",") 378 try : 379 patdict = {}.fromkeys(patterns) 380 except AttributeError : 381 # Python v2.2 or earlier 382 patdict = {} 383 for p in patterns : 384 patdict[p] = None 378 385 for record in result : 379 386 pname = self.databaseToUserCharset(record["printername"]) 380 if self.tool.matchString(pname, patterns) :387 if patdict.has_key(pname) or self.tool.matchString(pname, patterns) : 381 388 printer = StoragePrinter(self, pname) 382 389 printer.ident = record.get("id") … … 404 411 if result : 405 412 patterns = userpattern.split(",") 413 try : 414 patdict = {}.fromkeys(patterns) 415 except AttributeError : 416 # Python v2.2 or earlier 417 patdict = {} 418 for p in patterns : 419 patdict[p] = None 406 420 for record in result : 407 421 uname = self.databaseToUserCharset(record["username"]) 408 if self.tool.matchString(uname, patterns) :422 if patdict.has_key(uname) or self.tool.matchString(uname, patterns) : 409 423 user = StorageUser(self, uname) 410 424 user.ident = record.get("id") … … 429 443 if result : 430 444 patterns = grouppattern.split(",") 445 try : 446 patdict = {}.fromkeys(patterns) 447 except AttributeError : 448 # Python v2.2 or earlier 449 patdict = {} 450 for p in patterns : 451 patdict[p] = None 431 452 for record in result : 432 453 gname = self.databaseToUserCharset(record["groupname"]) 433 if self.tool.matchString(gname, patterns) :454 if patdict.has_key(gname) or self.tool.matchString(gname, patterns) : 434 455 group = StorageGroup(self, gname) 435 456 group.ident = record.get("id")