Changeset 853
- Timestamp:
- 03/16/03 09:00:50 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/conf/pykota.conf.sample
r852 r853 32 32 # Where to log ? 33 33 # supported values : stderr, system (system means syslog, but don't use 'syslog' here) 34 # if the value is not set then the default SYSTEM applies. 34 35 logger: system 35 36 36 37 # Mail server to use to warn users 38 # If the value is not set then localhost is used. 37 39 smtpserver: localhost 38 40 … … 44 46 # These values can be set either globally or per printer or both. 45 47 # If both are defined, the printer option has priority. 48 # If these values are not set, the default admin root 49 # and the default adminmail root@localhost are used. 46 50 admin: Jerome Alet 47 51 adminmail: alet@librelogiciel.com … … 55 59 # This value can be set either globally or per printer or both. 56 60 # If both are defined, the printer option has priority. 61 # If the value is not set, then the default BOTH applies. 57 62 mailto: both 58 63 … … 61 66 # This value can be set either globally or per printer or both. 62 67 # If both are defined, the printer option has priority. 68 # If the value is not set then the default seven (7) days applies. 63 69 gracedelay: 7 64 70 65 # one section per printer, or no other section at all if all options are defined globally 71 # one section per printer, or no other section at all if all options 72 # are defined globally 66 73 [lp] 67 74 … … 85 92 # This value can be set either globally or per printer or both. 86 93 # If both are defined, the printer option has priority. 94 # If the value is not set then the default policy ALLOW applies. 87 95 policy: allow 88 96 -
pykota/trunk/NEWS
r852 r853 26 26 - Both means the User and the Admin will receive them. 27 27 28 - The configuration file now uses hard-coded default values 29 when an option is not set. See sample configuration file 30 for details. 31 28 32 - Manual pages are included since 1.00, but I forgot to 29 33 add this information to this file. -
pykota/trunk/pykota/config.py
r852 r853 15 15 # 16 16 # $Log$ 17 # Revision 1.18 2003/03/16 08:00:50 jalet 18 # Default hard coded options are now used if they are not set in the 19 # configuration file. 20 # 17 21 # Revision 1.17 2003/03/15 23:01:28 jalet 18 22 # New mailto option in configuration file added. … … 152 156 """Returns the logging backend information.""" 153 157 validloggers = [ "stderr", "system" ] 154 logger = self.getGlobalOption("logger").lower() 158 try : 159 logger = self.getGlobalOption("logger").lower() 160 except PyKotaConfigError : 161 logger = "system" 155 162 if logger not in validloggers : 156 163 raise PyKotaConfigError, _("Option logger only supports values in %s") % str(validloggers) … … 176 183 """Returns the default policy for the current printer.""" 177 184 validpolicies = [ "ALLOW", "DENY" ] 178 policy = self.getPrinterOption(printer, "policy").upper() 185 try : 186 policy = self.getPrinterOption(printer, "policy").upper() 187 except PyKotaConfigError : 188 policy = "ALLOW" 179 189 if policy not in validpolicies : 180 190 raise PyKotaConfigError, _("Option policy in section %s only supports values in %s") % (printer, str(validpolicies)) … … 183 193 def getSMTPServer(self) : 184 194 """Returns the SMTP server to use to send messages to users.""" 185 return self.getGlobalOption("smtpserver") 195 try : 196 return self.getGlobalOption("smtpserver") 197 except PyKotaConfigError : 198 return "localhost" 186 199 187 200 def getAdminMail(self, printer) : 188 201 """Returns the Email address of the Print Quota Administrator.""" 189 return self.getPrinterOption(printer, "adminmail") 202 try : 203 return self.getPrinterOption(printer, "adminmail") 204 except PyKotaConfigError : 205 return "root@localhost" 190 206 191 207 def getAdmin(self, printer) : 192 208 """Returns the full name of the Print Quota Administrator.""" 193 return self.getPrinterOption(printer, "admin") 209 try : 210 return self.getPrinterOption(printer, "admin") 211 except PyKotaConfigError : 212 return "root" 194 213 195 214 def getMailTo(self, printer) : 196 215 """Returns the recipient of email messages.""" 197 216 validmailtos = [ "DEVNULL", "BOTH", "USER", "ADMIN" ] 198 mailto = self.getPrinterOption(printer, "mailto").upper() 217 try : 218 mailto = self.getPrinterOption(printer, "mailto").upper() 219 except PyKotaConfigError : 220 mailto = "BOTH" 199 221 if mailto not in validmailtos : 200 222 raise PyKotaConfigError, _("Option mailto in section %s only supports values in %s") % (printer, str(validmailtos)) … … 203 225 def getGraceDelay(self, printer) : 204 226 """Returns the grace delay in days.""" 205 gd = self.getPrinterOption(printer, "gracedelay") 227 try : 228 gd = self.getPrinterOption(printer, "gracedelay") 229 except PyKotaConfigError : 230 gd = 7 206 231 try : 207 232 return int(gd)