Show
Ignore:
Timestamp:
06/10/05 22:39:13 (19 years ago)
Author:
jerome
Message:

Extended syntax for the denyduplicates directive : it now
allows any external command to be launched, which will decide
if the dupes should be allowed or not.

Files:
1 modified

Legend:

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

    r2307 r2308  
    4949    def isTrue(self, option) :         
    5050        """Returns 1 if option is set to true, else 0.""" 
    51         if (option is not None) and (option.upper().strip() in ['Y', 'YES', '1', 'ON', 'T', 'TRUE']) : 
     51        if (option is not None) and (option.strip().upper() in ['Y', 'YES', '1', 'ON', 'T', 'TRUE']) : 
     52            return 1 
     53        else :     
     54            return 0 
     55                         
     56    def isFalse(self, option) :         
     57        """Returns 1 if option is set to false, else 0.""" 
     58        if (option is not None) and (option.strip().upper() in ['N', 'NO', '0', 'OFF', 'F', 'FALSE']) : 
    5259            return 1 
    5360        else :     
     
    394401         
    395402    def getDenyDuplicates(self, printername) :           
    396         """Returns 1 if we want to deny duplicate jobs, else 0.""" 
     403        """Returns 1 or a command if we want to deny duplicate jobs, else 0.""" 
    397404        try :  
    398             return self.isTrue(self.getPrinterOption(printername, "denyduplicates")) 
     405            denyduplicates = self.getPrinterOption(printername, "denyduplicates") 
    399406        except PyKotaConfigError :     
    400407            return 0 
     408        else :     
     409            if self.isTrue(denyduplicates) : 
     410                return 1 
     411            elif self.isFalse(denyduplicates) : 
     412                return 0 
     413            else :     
     414                # it's a command to run. 
     415                return denyduplicates 
    401416         
    402417    def getWinbindSeparator(self) :