Changeset 1252
- Timestamp:
- 01/06/04 17:02:57 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storage.py
r1250 r1252 22 22 # 23 23 # $Log$ 24 # Revision 1.32 2004/01/06 16:02:57 jalet 25 # This time printer groups caching works. 26 # 24 27 # Revision 1.31 2004/01/06 15:51:24 jalet 25 28 # Fixed caching of printer groups … … 353 356 if self.usecache : 354 357 self.tool.logdebug("Caching enabled.") 355 self.caches = { "USERS" : {}, "GROUPS" : {}, "PRINTERS" : {}, "USERPQUOTAS" : {}, "GROUPPQUOTAS" : {}, "JOBS" : {}, "LASTJOBS" : {} , "PARENTPRINTERS" : {}}358 self.caches = { "USERS" : {}, "GROUPS" : {}, "PRINTERS" : {}, "USERPQUOTAS" : {}, "GROUPPQUOTAS" : {}, "JOBS" : {}, "LASTJOBS" : {} } 356 359 357 360 def close(self) : … … 431 434 def getParentPrinters(self, printer) : 432 435 """Extracts parent printers information for a given printer from cache.""" 433 parents = self.getFromCache("PARENTPRINTERS", printer.Name) 434 if parents is None : 435 parents = self.getParentPrintersFromBackend(printer) 436 self.cacheEntry("PARENTPRINTERS", printer.Name, parents) 437 return parents 436 if self.usecache : 437 if not hasattr(printer, "Parents") : 438 self.tool.logdebug("Cache miss (%s->Parents)" % printer.Name) 439 printer.Parents = self.getParentPrintersFromBackend(printer) 440 self.tool.logdebug("Cache store (%s->Parents)" % printer.Name) 441 else : 442 self.tool.logdebug("Cache hit (%s->Parents)" % printer.Name) 443 else : 444 printer.Parents = self.getParentPrintersFromBackend(printer) 445 return printer.Parents 438 446 439 447 def getGroupMembers(self, group) :