[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/gnue-common src/GConfig.py src/dbdrivers/p...
From: |
James Thompson |
Subject: |
gnue/gnue-common src/GConfig.py src/dbdrivers/p... |
Date: |
Sat, 30 Jun 2001 11:37:33 -0700 |
CVSROOT: /cvs
Module name: gnue
Changes by: James Thompson <address@hidden> 01/06/30 11:37:32
Modified files:
gnue-common/src: GConfig.py
gnue-common/src/dbdrivers/postgresql: DBdriver.py
Added files:
gnue-common/etc: sample-windows.gnue.conf
Log message:
More changes in prep for next release
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/etc/sample-windows.gnue.conf?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GConfig.py.diff?cvsroot=OldCVS&tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
Patches:
Index: gnue/gnue-common/src/GConfig.py
diff -u gnue/gnue-common/src/GConfig.py:1.4 gnue/gnue-common/src/GConfig.py:1.5
--- gnue/gnue-common/src/GConfig.py:1.4 Tue Jun 26 20:20:35 2001
+++ gnue/gnue-common/src/GConfig.py Sat Jun 30 11:37:32 2001
@@ -1,114 +1,135 @@
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise is free software; you can redistribute it
-# and/or modify it under the terms of the GNU General Public
-# License as published by the Free Software Foundation; either
-# version 2, or (at your option) any later version.
-#
-# GNU Enterprise is distributed in the hope that it will be
-# useful, but WITHOUT ANY WARRANTY; without even the implied
-# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# License along with program; see the file COPYING. If not,
-# write to the Free Software Foundation, Inc., 59 Temple Place
-# - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright 2000, 2001 Free Software Foundation
-#
-# FILE:
-# GConfig.py
-#
-# DESCRIPTION:
-# Class that loads the gnue.conf files so gnue apps can get
-# default settings.
-#
-# NOTES:
-#
-# HISTORY:
-#
-
-from GConfigParser import *
-import os
-from gnue.common import openResource
-import string
-import GDebug
-import GDataObjects
-import GLoginHandler
-
-_OPTION = {}
-
-class _NOOPTION:
- pass
-
-def get(varName, default=_NOOPTION):
- global _OPTION
- if hasattr(_OPTION, string.lower(varName)) or default == _NOOPTION:
- return _OPTION[string.lower(varName)]
- else:
- return default
-
-class InvalidFormatError (StandardError):
- # Raised if the Connections Definition File is
- # in an unreadable format.
- pass
-
-
-class GConfig:
- def __init__(self, application):
- self._application = application
-
- GDebug.printMesg(1,'Application style: %s' % self._application)
- GDebug.printMesg(1,'Reading basic configuration')
- if os.environ.has_key('INSTALL_PREFIX'):
- location = os.environ['INSTALL_PREFIX']+'/etc/gnue.conf'
- try:
- self.readConfig(location)
- except:
- GDebug.printMesg (1,'File not available')
-
- GDebug.printMesg(1,'Reading user configuration overrides')
- if os.environ.has_key('HOME'):
- location = os.environ['HOME']+'/.gnue/gnue.conf'
- try:
- self.readConfig(location)
- except:
- GDebug.printMesg (1,'File not available')
-
- GDebug.printMesg(1,'Reading fixed system configuration')
- if os.environ.has_key('INSTALL_PREFIX'):
- location = os.environ['INSTALL_PREFIX']+'/etc/gnue.conf.fixed'
- try:
- self.readConfig(location)
- except:
- GDebug.printMesg (1,'File not available')
-
- def readConfig(self,location):
- global _OPTION
- self._parser = GConfigParser()
-
- GDebug.printMesg(1,'Configuration File: "%s"' % location)
- drive = os.path.splitdrive(location)
-
- fileHandle = openResource(location)
-
- try:
- self._parser.readfp(fileHandle)
- except DuplicateSectionError:
- raise InvalidFormatError, 'The file has duplicate source definitions.'
- except MissingSectionHeaderError:
- raise InvalidFormatError, 'The file has no source definitions.'
- except:
- print'The file cannot be parsed. %s :: %s' % (sys.exc_type,
sys.exc_value)
- raise InvalidFormatError, 'The file cannot be parsed.'
-
- for option in self._parser.options(self._application):
- _OPTION[option] = self._parser.get(self._application,option)
-
-
-
-
-
-
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2000, 2001 Free Software Foundation
+#
+# FILE:
+# GConfig.py
+#
+# DESCRIPTION:
+# Class that loads the gnue.conf files so gnue apps can get
+# default settings.
+#
+# NOTES:
+#
+# HISTORY:
+#
+
+from GConfigParser import *
+import os
+from gnue.common import openResource
+import string
+import GDebug
+import GDataObjects
+import GLoginHandler
+
+TRUE = 1
+FALSE = 0
+
+_OPTION = {}
+
+class _NOOPTION:
+ pass
+
+def get(varName, default=_NOOPTION):
+ global _OPTION
+ if hasattr(_OPTION, string.lower(varName)) or default == _NOOPTION:
+ return _OPTION[string.lower(varName)]
+ else:
+ return default
+
+class InvalidFormatError (StandardError):
+ # Raised if the Connections Definition File is
+ # in an unreadable format.
+ pass
+
+
+class GConfig:
+ def __init__(self, application):
+
+ self._application = application
+
+ _success = FALSE
+
+ GDebug.printMesg(1,'Application style: %s' % self._application)
+ GDebug.printMesg(1,'Reading basic configuration')
+ if os.environ.has_key('INSTALL_PREFIX'):
+ location = os.environ['INSTALL_PREFIX']+'/etc/gnue.conf'
+ 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'):
+ location = os.environ['HOME']+'/.gnue/gnue.conf'
+ 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'):
+ location = os.environ['INSTALL_PREFIX']+'/etc/gnue.conf.fixed'
+ 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):
+ global _OPTION
+ self._parser = GConfigParser()
+
+ GDebug.printMesg(1,'Configuration File: "%s"' % location)
+ drive = os.path.splitdrive(location)
+
+ fileHandle = openResource(location)
+
+ try:
+ self._parser.readfp(fileHandle)
+ except DuplicateSectionError:
+ raise InvalidFormatError, 'The file has duplicate source definitions.'
+ except MissingSectionHeaderError:
+ raise InvalidFormatError, 'The file has no source definitions.'
+ except:
+ print'The file cannot be parsed. %s :: %s' % (sys.exc_type,
sys.exc_value)
+ raise InvalidFormatError, 'The file cannot be parsed.'
+
+ for option in self._parser.options(self._application):
+ _OPTION[option] = self._parser.get(self._application,option)
+
+
+
+
+
+
Index: gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py
diff -u gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.6
gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.7
--- gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py:1.6 Mon Jun 25
21:32:46 2001
+++ gnue/gnue-common/src/dbdrivers/postgresql/DBdriver.py Sat Jun 30
11:37:32 2001
@@ -28,7 +28,9 @@
# NOTES:
#
-import pgdb
+
+import pg
+
from string import lower
import sys
from gnue.common import GDebug, GDataObjects
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/gnue-common src/GConfig.py src/dbdrivers/p...,
James Thompson <=