VirtualMailManager/Config.py
branchv0.6.x
changeset 175 b241272eb1bd
parent 174 974bafa59330
child 178 9480f2b15129
equal deleted inserted replaced
174:974bafa59330 175:b241272eb1bd
   330         """
   330         """
   331         try:
   331         try:
   332             self.__cfgFile = open(self.__cfgFileName, 'r')
   332             self.__cfgFile = open(self.__cfgFileName, 'r')
   333             self.readfp(self.__cfgFile)
   333             self.readfp(self.__cfgFile)
   334         except (MissingSectionHeaderError, ParsingError), e:
   334         except (MissingSectionHeaderError, ParsingError), e:
   335             self.__cfgFile.close()
       
   336             raise VMMConfigException(str(e), ERR.CONF_ERROR)
   335             raise VMMConfigException(str(e), ERR.CONF_ERROR)
   337         self.__cfgFile.close()
   336         finally:
       
   337             if not self.__cfgFile is None and not self.__cfgFile.closed:
       
   338                 self.__cfgFile.close()
   338 
   339 
   339     def check(self):
   340     def check(self):
   340         """Performs a configuration check.
   341         """Performs a configuration check.
   341 
   342 
   342         Raises a VMMConfigException if the check fails.
   343         Raises a VMMConfigException if the check fails.