Show
Ignore:
Timestamp:
02/26/04 15:18:07 (20 years ago)
Author:
jalet
Message:

Should fix the remaining bugs wrt printers groups and users groups.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storage.py

    r1364 r1365  
    2222# 
    2323# $Log$ 
     24# Revision 1.46  2004/02/26 14:18:07  jalet 
     25# Should fix the remaining bugs wrt printers groups and users groups. 
     26# 
    2427# Revision 1.45  2004/02/26 10:40:40  jalet 
    2528# Fixed nested printer groups accounting. 
     
    394397        self.DateLimit = None 
    395398         
     399    def __getattr__(self, name) :     
     400        """Delays data retrieval until it's really needed.""" 
     401        if name == "ParentPrintersGroupPQuota" :  
     402            self.ParentPrintersGroupPQuota = (self.Group.Exists and self.Printer.Exists and self.parent.getParentPrintersGroupPQuota(self)) or [] 
     403            return self.ParentPrintersGroupPQuota 
     404        else : 
     405            raise AttributeError, name 
     406         
    396407    def setDateLimit(self, datelimit) :     
    397408        """Sets the date limit for this quota.""" 
     
    555566        for parent in printer.Parents[:] :     
    556567            printer.Parents.extend(self.getParentPrinters(parent)) 
    557         self.tool.logdebug("=== %i ===> %s" % (len(printer.Parents), [p.Name for p in printer.Parents])) 
    558568        return printer.Parents 
    559569         
     
    586596    def getParentPrintersUserPQuota(self, userpquota) :      
    587597        """Returns all user print quota on the printer and all its parents recursively.""" 
    588         upquotas = [] 
     598        upquotas = [ ] 
    589599        for printer in self.getParentPrinters(userpquota.Printer) : 
    590600            upquotas.append(self.getUserPQuota(userpquota.User, printer)) 
    591         self.tool.logdebug("UPQUOTAS : %i ===> %s" % (len(upquotas), ["%s/%s" % (upq.User.Name, upq.Printer.Name) for upq in upquotas])) 
    592601        return upquotas         
     602         
     603    def getParentPrintersGroupPQuota(self, grouppquota) :      
     604        """Returns all group print quota on the printer and all its parents recursively.""" 
     605        gpquotas = [ ] 
     606        for printer in self.getParentPrinters(grouppquota.Printer) : 
     607            gpquotas.append(self.getGroupPQuota(grouppquota.Group, printer)) 
     608        return gpquotas         
    593609         
    594610def openConnection(pykotatool) :