Changeset 783

Show
Ignore:
Timestamp:
02/10/03 09:19:57 (22 years ago)
Author:
jalet
Message:

tell ConfigParser? to return raw data, this allows our own strings
interpolations in the requester

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/conf/pykota.conf.sample

    r782 r783  
    5858#     snmp(public, 43.10.2.1.4.1.1) 
    5959# are equivalent 
    60 # WARNING : external doesn't work yet because of ConfigParser  
    61 # which tries to do the %(printer)s substitution itself 
    62 requester: snmp(public, 43.10.2.1.4.1.1) 
     60# requester: snmp(public, 43.10.2.1.4.1.1) 
     61external(snmpget -c public -Ov %(printer)s 43.10.2.1.4.1.1 | cut -f 2,2 -d " ") 
    6362# 
    6463# Default policy for inexistant users (e.g. root) 
  • pykota/trunk/pykota/config.py

    r781 r783  
    1515# 
    1616# $Log$ 
     17# Revision 1.10  2003/02/10 08:19:57  jalet 
     18# tell ConfigParser to return raw data, this allows our own strings 
     19# interpolations in the requester 
     20# 
    1721# Revision 1.9  2003/02/10 00:44:38  jalet 
    1822# Typos 
     
    8589        # more precise checks         
    8690        validloggers = [ "stderr", "system" ]  
    87         if self.config.get("global", "logger").lower() not in validloggers :              
     91        if self.config.get("global", "logger", raw=1).lower() not in validloggers :              
    8892            raise PyKotaConfigError, _("Option logger only supports values in %s") % str(validloggers) 
    8993             
    9094        validmethods = [ "lazy" ] # TODO add more methods             
    91         if self.config.get("global", "method").lower() not in validmethods :              
     95        if self.config.get("global", "method", raw=1).lower() not in validmethods :              
    9296            raise PyKotaConfigError, _("Option method only supports values in %s") % str(validmethods) 
    9397             
     
    99103                     
    100104            validpolicies = [ "ALLOW", "DENY" ]      
    101             if self.config.get(printer, "policy").upper() not in validpolicies : 
     105            if self.config.get(printer, "policy", raw=1).upper() not in validpolicies : 
    102106                raise PyKotaConfigError, _("Option policy in section %s only supports values in %s") % (printer, str(validpolicies)) 
    103107             
    104108            validrequesters = [ "snmp", "external" ] # TODO : add more requesters 
    105             fullrequester = self.config.get(printer, "requester") 
     109            fullrequester = self.config.get(printer, "requester", raw=1) 
    106110            try : 
    107111                (requester, args) = [x.strip() for x in fullrequester.split('(')] 
     
    128132                        "storageuser", # TODO : "storageadminpw", "storageusepw", \ 
    129133                      ] : 
    130             backendinfo.append(self.config.get("global", option)) 
     134            backendinfo.append(self.config.get("global", option, raw=1)) 
    131135        return tuple(backendinfo)     
    132136         
    133137    def getLoggingBackend(self) :     
    134138        """Returns the logging backend information.""" 
    135         return self.config.get("global", "logger").lower() 
     139        return self.config.get("global", "logger", raw=1).lower() 
    136140         
    137141    def getRequesterBackend(self, printer) :     
    138142        """Returns the requester backend to use for a given printer, with its arguments.""" 
    139         fullrequester = self.config.get(printer, "requester") 
     143        fullrequester = self.config.get(printer, "requester", raw=1) 
    140144        (requester, args) = [x.strip() for x in fullrequester.split('(')] 
    141145        if args.endswith(')') : 
     
    148152    def getPrinterPolicy(self, printer) :     
    149153        """Returns the default policy for the current printer.""" 
    150         return self.config.get(printer, "policy").upper() 
     154        return self.config.get(printer, "policy", raw=1).upper() 
    151155         
    152156    def getSMTPServer(self) :     
    153157        """Returns the SMTP server to use to send messages to users.""" 
    154         return self.config.get("global", "smtpserver").lower() 
     158        return self.config.get("global", "smtpserver", raw=1) 
    155159         
    156160    def getAdminMail(self) :     
    157161        """Returns the Email address of the Print Quota Administrator.""" 
    158         return self.config.get("global", "adminmail") 
     162        return self.config.get("global", "adminmail", raw=1) 
    159163         
    160164    def getAdmin(self) :     
    161165        """Returns the full name of the Print Quota Administrator.""" 
    162         return self.config.get("global", "admin") 
     166        return self.config.get("global", "admin", raw=1) 
    163167         
    164168    def getGraceDelay(self) :     
    165169        """Returns the grace delay in days.""" 
    166         gd = self.config.get("global", "gracedelay") 
     170        gd = self.config.get("global", "gracedelay", raw=1) 
    167171        try : 
    168172            return int(gd)