Changeset 1537 for pykota/trunk

Show
Ignore:
Timestamp:
06/11/04 09:07:38 (20 years ago)
Author:
jalet
Message:

Now detects and logs configuration syntax errors instead of failing without
any notice message.

Files:
1 modified

Legend:

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

    r1532 r1537  
    2222# 
    2323# $Log$ 
     24# Revision 1.99  2004/06/11 07:07:38  jalet 
     25# Now detects and logs configuration syntax errors instead of failing without 
     26# any notice message. 
     27# 
    2428# Revision 1.98  2004/06/08 19:27:12  jalet 
    2529# Doesn't ignore SIGCHLD anymore 
     
    379383import socket 
    380384import tempfile 
     385import ConfigParser 
    381386 
    382387from mx import DateTime 
     
    407412        # pykota specific stuff 
    408413        self.documentation = doc 
    409         self.config = config.PyKotaConfig("/etc/pykota") 
     414        try : 
     415            self.config = config.PyKotaConfig("/etc/pykota") 
     416        except ConfigParser.ParsingError, msg :     
     417            sys.stderr.write("ERROR: Problem encountered while parsing configuration file : %s\n" % msg) 
     418            sys.stderr.flush() 
     419            sys.exit(-1) 
    410420        self.debug = self.config.getDebug() 
    411421        self.smtpserver = self.config.getSMTPServer() 
     
    414424            self.logger = logger.openLogger(self.config.getLoggingBackend()) 
    415425            self.storage = storage.openConnection(self) 
    416         except (logger.PyKotaLoggingError, storage.PyKotaStorageError), msg : 
     426        except (config.PyKotaConfigError, logger.PyKotaLoggingError, storage.PyKotaStorageError), msg : 
    417427            self.crashed(msg) 
    418428            raise