/[gnue]/gnue-common/src/apps/GConfig.py
ViewVC logotype

Diff of /gnue-common/src/apps/GConfig.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.34 by jamest, Sat Mar 22 20:43:54 2003 UTC revision 1.35 by siesel, Thu Sep 4 21:03:09 2003 UTC
# Line 68  class GConfig: Line 68  class GConfig:
68    #    #
69    def loadApplicationConfig(self, configFilename="gnue.conf", homeConfigDir=".gnue", section="DEFAULT", defaults = None):    def loadApplicationConfig(self, configFilename="gnue.conf", homeConfigDir=".gnue", section="DEFAULT", defaults = None):
70    
71      GDebug.printMesg(1,'Reading configuration info from %s section %s' %(configFilename,section))      GDebug.printMesg(1,'Reading configuration info from %s section %s' % (configFilename, section))
72    
73      #      #
74      # Create parser and populate it if it doesn't exist      # Create parser and populate it if it doesn't exist
# Line 101  class GConfig: Line 101  class GConfig:
101        #        #
102        try:        try:
103          parser.read(fileLocations)          parser.read(fileLocations)
104            GDebug.printMesg(1,'Configuration files were read in this order:  %s' % \
105                             (fileLocations) )
106        except DuplicateSectionError:        except DuplicateSectionError:
107          raise InvalidFormatError, _('The file has duplicate source definitions.')          raise InvalidFormatError, _('The file has duplicate source definitions.')
108        except MissingSectionHeaderError:        except MissingSectionHeaderError:
# Line 147  class GConfig: Line 149  class GConfig:
149    def gConfig(self, varName, configFilename=None, section=None):    def gConfig(self, varName, configFilename=None, section=None):
150      if not configFilename: configFilename = self._defaultConfigFilename      if not configFilename: configFilename = self._defaultConfigFilename
151      if not section: section = self._defaultSection      if not section: section = self._defaultSection
   
152      try:      try:
153        return self._loadedConfigs[configFilename].get(section,varName)        return self._loadedConfigs[configFilename].get(section,varName)
154      except NoSectionError:      except NoSectionError:
# Line 164  class GConfig: Line 165  class GConfig:
165    def gConfigDict(self, configFilename=None, section=None):    def gConfigDict(self, configFilename=None, section=None):
166      if not configFilename: configFilename = self._defaultConfigFilename      if not configFilename: configFilename = self._defaultConfigFilename
167      if not section:      section = self._defaultSection      if not section:      section = self._defaultSection
168    
169      options = {}      options = {}
170      for option in self._loadedConfigs[configFilename].options(section):      for option in self._loadedConfigs[configFilename].options(section):
171          options[option] =  self._loadedConfigs[configFilename].get(section,string.lower(option))          options[option] =  self._loadedConfigs[configFilename].get(section,string.lower(option))

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26