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/pgstorage.py

    r1244 r1249  
    2222# 
    2323# $Log$ 
     24# Revision 1.27  2004/01/06 14:24:59  jalet 
     25# Printer groups should be cached now, if caching is enabled. 
     26# 
    2427# Revision 1.26  2003/12/29 14:12:48  uid67467 
    2528# Tries to workaround possible integrity violations when retrieving printer groups 
     
    338341                groups.append(self.getGroup(record.get("groupname"))) 
    339342        return groups         
     343         
     344    def getParentPrintersFromBackend(self, printer) :     
     345        """Get all the printer groups this printer is a member of.""" 
     346        pgroups = [] 
     347        result = self.doSearch("SELECT groupid,printername FROM printergroupsmembers JOIN printers ON groupid=id WHERE printerid=%s;" % self.doQuote(printer.ident)) 
     348        if result : 
     349            for record in result : 
     350                if record["groupid"] != printer.ident : # in case of integrity violation 
     351                    parentprinter = self.getPrinter(record.get("printername")) 
     352                    if parentprinter.Exists : 
     353                        pgroups.append(parentprinter) 
     354        return pgroups 
    340355         
    341356    def getMatchingPrinters(self, printerpattern) : 
     
    398413        return groupsandquotas 
    399414         
    400     def getParentPrinters(self, printer) :     
    401         """Get all the printer groups this printer is a member of.""" 
    402         pgroups = [] 
    403         result = self.doSearch("SELECT groupid,printername FROM printergroupsmembers JOIN printers ON groupid=id WHERE printerid=%s;" % self.doQuote(printer.ident)) 
    404         if result : 
    405             for record in result : 
    406                 if record["groupid"] != printer.ident : # in case of integrity violation 
    407                     parentprinter = self.getPrinter(record.get("printername")) 
    408                     if parentprinter.Exists : 
    409                         pgroups.append(parentprinter) 
    410         return pgroups 
    411          
    412415    def addPrinter(self, printername) :         
    413416        """Adds a printer to the quota storage, returns it."""