Index: pykota/trunk/pykota/tool.py
===================================================================
--- pykota/trunk/pykota/tool.py (revision 2195)
+++ pykota/trunk/pykota/tool.py (revision 2210)
@@ -74,10 +74,10 @@
         
         # locale stuff
-        defaultToCLocale = 0
+        self.defaultToCLocale = 0
         try :
             locale.setlocale(locale.LC_ALL, lang)
         except (locale.Error, IOError) :
             locale.setlocale(locale.LC_ALL, "C")
-            defaultToCLocale = 1
+            self.defaultToCLocale = 1
         try :
             gettext.install("pykota")
@@ -109,4 +109,6 @@
         self.documentation = doc
         
+    def deferredInit(self) :        
+        """Deferred initialization."""
         # try to find the configuration files in user's 'pykota' home directory.
         try :
@@ -120,19 +122,9 @@
             missingUser = 0
             
-        try :
-            self.config = config.PyKotaConfig(confdir)
-        except ConfigParser.ParsingError, msg :    
-            sys.stderr.write("ERROR: Problem encountered while parsing configuration file : %s\n" % msg)
-            sys.stderr.flush()
-            sys.exit(-1)
-            
-        try :
-            self.debug = self.config.getDebug()
-            self.smtpserver = self.config.getSMTPServer()
-            self.maildomain = self.config.getMailDomain()
-            self.logger = logger.openLogger(self.config.getLoggingBackend())
-        except (config.PyKotaConfigError, logger.PyKotaLoggingError, storage.PyKotaStorageError), msg :
-            self.crashed(msg)
-            raise
+        self.config = config.PyKotaConfig(confdir)
+        self.debug = self.config.getDebug()
+        self.smtpserver = self.config.getSMTPServer()
+        self.maildomain = self.config.getMailDomain()
+        self.logger = logger.openLogger(self.config.getLoggingBackend())
             
         # now drop priviledge if possible
@@ -143,5 +135,5 @@
         self.softwareJobPrice = 0.0
         
-        if defaultToCLocale :
+        if self.defaultToCLocale :
             self.printInfo("Incorrect locale settings. PyKota falls back to the 'C' locale.", "warn")
         if missingUser :     
@@ -201,4 +193,11 @@
         sys.stderr.flush()
         
+    def matchString(self, s, patterns) :
+        """Returns 1 if the string s matches one of the patterns, else 0."""
+        for pattern in patterns :
+            if fnmatch.fnmatchcase(s, pattern) :
+                return 1
+        return 0
+        
     def display_version_and_quit(self) :
         """Displays version number, then exists successfully."""
@@ -302,14 +301,13 @@
         """Initializes the command line tool and opens the database."""
         Tool.__init__(self, lang, charset, doc)
-        try :
-            self.storage = storage.openConnection(self)
-        except storage.PyKotaStorageError, msg :
-            self.crashed(msg)
-            raise
+        
+    def deferredInit(self) :    
+        """Deferred initialization."""
+        Tool.deferredInit(self)
+        self.storage = storage.openConnection(self)
+        if self.config.isAdmin : # TODO : We don't know this before, fix this !
+            self.logdebug("Beware : running as a PyKota administrator !")
         else :    
-            if self.config.isAdmin : # TODO : We don't know this before, fix this !
-                self.logdebug("Beware : running as a PyKota administrator !")
-            else :    
-                self.logdebug("Don't Panic : running as a mere mortal !")
+            self.logdebug("Don't Panic : running as a mere mortal !")
         
     def clean(self) :    
@@ -327,11 +325,4 @@
                 return 0
         return 1        
-        
-    def matchString(self, s, patterns) :
-        """Returns 1 if the string s matches one of the patterns, else 0."""
-        for pattern in patterns :
-            if fnmatch.fnmatchcase(s, pattern) :
-                return 1
-        return 0
         
     def sendMessage(self, adminmail, touser, fullmessage) :
@@ -655,4 +646,8 @@
          self.originalbackend) = self.extractInfoFromCupsOrLprng()
          
+    def deferredInit(self) :
+        """Deferred initialization."""
+        PyKotaTool.deferredInit(self)
+        
         arguments = " ".join(['"%s"' % arg for arg in sys.argv])
         self.logdebug(_("Printing system %s, args=%s") % (str(self.printingsystem), arguments))
