Changeset 853 for pykota/trunk/pykota/config.py
- Timestamp:
- 03/16/03 09:00:50 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
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)