[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/common/src GConfig.py GBaseApp.py
From: |
Jan Ischebeck |
Subject: |
gnue/common/src GConfig.py GBaseApp.py |
Date: |
Tue, 23 Apr 2002 19:25:24 -0400 |
CVSROOT: /cvsroot/gnue
Module name: gnue
Changes by: Jan Ischebeck <address@hidden> 02/04/23 19:25:24
Modified files:
common/src : GConfig.py GBaseApp.py
Log message:
approved error handling
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConfig.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GBaseApp.py.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
Patches:
Index: gnue/common/src/GBaseApp.py
diff -c gnue/common/src/GBaseApp.py:1.12 gnue/common/src/GBaseApp.py:1.13
*** gnue/common/src/GBaseApp.py:1.12 Sun Apr 21 18:56:15 2002
--- gnue/common/src/GBaseApp.py Tue Apr 23 19:25:24 2002
***************
*** 38,43 ****
--- 38,44 ----
import os
import GConnections
import GConfig
+ import ConfigParser
class GBaseApp:
***************
*** 167,173 ****
# Read the config files
if application:
! GConfig.GConfig(application)
# Get the connection definitions
if connections != None:
--- 168,184 ----
# Read the config files
if application:
! try:
! GConfig.GConfig(application)
! except ConfigParser.NoSectionError, msg:
! self.handleStartupError('The gnue.conf file is incomplete: '\
! + '\n %s' % msg)
! except Exception, msg:
! type=string.splitfields(str(sys.exc_type),'.')
! type.reverse()
! self.handleStartupError( \
! '%s while reading gnue.conf: ' % type[0] \
! + '\n %s' % msg)
# Get the connection definitions
if connections != None:
Index: gnue/common/src/GConfig.py
diff -c gnue/common/src/GConfig.py:1.13 gnue/common/src/GConfig.py:1.14
*** gnue/common/src/GConfig.py:1.13 Fri Apr 12 01:28:50 2002
--- gnue/common/src/GConfig.py Tue Apr 23 19:25:24 2002
***************
*** 70,75 ****
--- 70,76 ----
self._application = application
_success = FALSE
+ _error_type = None
GDebug.printMesg(1,'Application style: %s' % self._application)
GDebug.printMesg(1,'Reading basic configuration')
***************
*** 78,85 ****
try:
self.readConfig(location)
_success = TRUE
! except:
GDebug.printMesg (1,'File not available')
GDebug.printMesg(1,'Reading user configuration overrides')
if os.environ.has_key('HOME'):
--- 79,89 ----
try:
self.readConfig(location)
_success = TRUE
! except IOError:
GDebug.printMesg (1,'File not available')
+ except:
+ _error_type=sys.exc_type
+ _error_msg=sys.exc_value
GDebug.printMesg(1,'Reading user configuration overrides')
if os.environ.has_key('HOME'):
***************
*** 87,94 ****
try:
self.readConfig(location)
_success = TRUE
! except:
GDebug.printMesg (1,'File not available')
GDebug.printMesg(1,'Reading fixed system configuration')
if os.environ.has_key('INSTALL_PREFIX'):
--- 91,102 ----
try:
self.readConfig(location)
_success = TRUE
! except IOError:
GDebug.printMesg (1,'File not available')
+ except:
+ _error_type=sys.exc_type
+ _error_msg=sys.exc_value
+
GDebug.printMesg(1,'Reading fixed system configuration')
if os.environ.has_key('INSTALL_PREFIX'):
***************
*** 96,114 ****
try:
self.readConfig(location)
_success = TRUE
! except:
GDebug.printMesg (1,'File not available')
if not _success:
! print "The gnue.conf file appears to be missing\n\n" \
! +"The file should be located in one of the following locations\n"
! if os.environ.has_key('INSTALL_PREFIX'):
! print os.environ['INSTALL_PREFIX']+'/etc/gnue.conf'
! if os.environ.has_key('HOME'):
! print os.environ['HOME']+'/.gnue/gnue.conf'
! if os.environ.has_key('INSTALL_PREFIX'):
! print os.environ['INSTALL_PREFIX']+'/etc/gnue.conf.fixed'
! sys.exit("Missing GNUe config file")
def readConfig(self,location):
--- 104,131 ----
try:
self.readConfig(location)
_success = TRUE
! except IOError:
GDebug.printMesg (1,'File not available')
+ except:
+ _error_type=sys.exc_type
+ _error_msg=sys.exc_value
+
if not _success:
! if _error_type==None:
!
! print "The gnue.conf file appears to be missing\n\n" \
! +"The file should be located in one of the following
locations\n"
! if os.environ.has_key('INSTALL_PREFIX'):
! print os.environ['INSTALL_PREFIX']+'/etc/gnue.conf'
! if os.environ.has_key('HOME'):
! print os.environ['HOME']+'/.gnue/gnue.conf'
! if os.environ.has_key('INSTALL_PREFIX'):
! print os.environ['INSTALL_PREFIX']+'/etc/gnue.conf.fixed'
! sys.exit("Missing GNUe config file")
!
! else:
! raise Exception,_error_msg
def readConfig(self,location):
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/common/src GConfig.py GBaseApp.py,
Jan Ischebeck <=