Show
Ignore:
Timestamp:
01/06/04 15:24:59 (20 years ago)
Author:
jalet
Message:

Printer groups should be cached now, if caching is enabled.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/ldapstorage.py

    r1244 r1249  
    2222# 
    2323# $Log$ 
     24# Revision 1.43  2004/01/06 14:24:59  jalet 
     25# Printer groups should be cached now, if caching is enabled. 
     26# 
    2427# Revision 1.42  2003/12/29 14:12:48  uid67467 
    2528# Tries to workaround possible integrity violations when retrieving printer groups 
     
    499502        return groups         
    500503         
     504    def getParentPrintersFromBackend(self, printer) :     
     505        """Get all the printer groups this printer is a member of.""" 
     506        pgroups = [] 
     507        result = self.doSearch("(&(objectClass=pykotaPrinter)(uniqueMember=%s))" % printer.ident, ["pykotaPrinterName"], base=self.info["printerbase"]) 
     508        if result : 
     509            for (printerid, fields) in result : 
     510                if printerid != printer.ident : # In case of integrity violation. 
     511                    parentprinter = self.getPrinter(fields.get("pykotaPrinterName")[0]) 
     512                    if parentprinter.Exists : 
     513                        pgroups.append(parentprinter) 
     514        return pgroups 
     515         
    501516    def getMatchingPrinters(self, printerpattern) : 
    502517        """Returns the list of all printers for which name matches a certain pattern.""" 
     
    564579        return groupsandquotas 
    565580         
    566     def getParentPrinters(self, printer) :     
    567         """Get all the printer groups this printer is a member of.""" 
    568         pgroups = [] 
    569         result = self.doSearch("(&(objectClass=pykotaPrinter)(uniqueMember=%s))" % printer.ident, ["pykotaPrinterName"], base=self.info["printerbase"]) 
    570         if result : 
    571             for (printerid, fields) in result : 
    572                 if printerid != printer.ident : # In case of integrity violation. 
    573                     parentprinter = self.getPrinter(fields.get("pykotaPrinterName")[0]) 
    574                     if parentprinter.Exists : 
    575                         pgroups.append(parentprinter) 
    576         return pgroups 
    577          
    578581    def addPrinter(self, printername) :         
    579582        """Adds a printer to the quota storage, returns it."""