Changeset 3126
- Timestamp:
- 12/13/06 21:06:41 (18 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/config.py
r3125 r3126 54 54 55 55 def isTrue(self, option) : 56 """Returns 1 if option is set to true, else 0."""56 """Returns True if option is set to true, else False.""" 57 57 if (option is not None) and (option.strip().upper() in ['Y', 'YES', '1', 'ON', 'T', 'TRUE']) : 58 return 159 else : 60 return 058 return True 59 else : 60 return False 61 61 62 62 def isFalse(self, option) : 63 """Returns 1 if option is set to false, else 0."""63 """Returns True if option is set to false, else False.""" 64 64 if (option is not None) and (option.strip().upper() in ['N', 'NO', '0', 'OFF', 'F', 'FALSE']) : 65 return 166 else : 67 return 065 return True 66 else : 67 return False 68 68 69 69 def getPrinterNames(self) : … … 441 441 442 442 def getPrintCancelledBanners(self, printername) : 443 """Returns 1 if a banner should be printed when a job is cancelled, else 0."""443 """Returns True if a banner should be printed when a job is cancelled, else False.""" 444 444 try : 445 445 return self.isTrue(self.getPrinterOption(printername, "printcancelledbanners")) 446 446 except PyKotaConfigError : 447 return 1447 return True 448 448 449 449 def getGraceDelay(self, printername) : … … 502 502 503 503 def getPrivacy(self) : 504 """Returns 1 if privacy is activated, else 0."""504 """Returns True if privacy is activated, else False.""" 505 505 return self.isTrue(self.getGlobalOption("privacy", ignore=1)) 506 506 507 507 def getDebug(self) : 508 """Returns 1 if debugging is activated, else 0."""508 """Returns True if debugging is activated, else False.""" 509 509 return self.isTrue(self.getGlobalOption("debug", ignore=1)) 510 510 511 511 def getCaching(self) : 512 """Returns 1 if database caching is enabled, else 0."""512 """Returns True if database caching is enabled, else False.""" 513 513 return self.isTrue(self.getGlobalOption("storagecaching", ignore=1)) 514 514 515 515 def getLDAPCache(self) : 516 """Returns 1 if low-level LDAP caching is enabled, else 0."""516 """Returns True if low-level LDAP caching is enabled, else False.""" 517 517 return self.isTrue(self.getGlobalOption("ldapcache", ignore=1)) 518 518 519 519 def getDisableHistory(self) : 520 """Returns 1 if we want to disable history, else 0."""520 """Returns True if we want to disable history, else False.""" 521 521 return self.isTrue(self.getGlobalOption("disablehistory", ignore=1)) 522 522 523 523 def getUserNameToLower(self) : 524 """Returns 1 if we want to convert usernames to lowercase when printing, else 0."""524 """Returns True if we want to convert usernames to lowercase when printing, else False.""" 525 525 return self.isTrue(self.getGlobalOption("utolower", ignore=1)) 526 526 527 527 def getRejectUnknown(self) : 528 """Returns 1 if we want to reject the creation of unknown users or groups, else 0."""528 """Returns True if we want to reject the creation of unknown users or groups, else False.""" 529 529 return self.isTrue(self.getGlobalOption("reject_unknown", ignore=1)) 530 530 531 531 def getPrinterKeepFiles(self, printername) : 532 """Returns 1 if files must be kept on disk, else 0."""532 """Returns True if files must be kept on disk, else False.""" 533 533 try : 534 534 return self.isTrue(self.getPrinterOption(printername, "keepfiles")) 535 535 except PyKotaConfigError : 536 return 0536 return False 537 537 538 538 def getPrinterDirectory(self, printername) : … … 544 544 545 545 def getDenyDuplicates(self, printername) : 546 """Returns 1 or a command if we want to deny duplicate jobs, else 0."""546 """Returns True or a command if we want to deny duplicate jobs, else False.""" 547 547 try : 548 548 denyduplicates = self.getPrinterOption(printername, "denyduplicates") 549 549 except PyKotaConfigError : 550 return 0550 return False 551 551 else : 552 552 if self.isTrue(denyduplicates) : 553 return 1553 return True 554 554 elif self.isFalse(denyduplicates) : 555 return 0555 return False 556 556 else : 557 557 # it's a command to run.