Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.99 KB | None | 0 0
  1.     def _load_conf(self, section, option):
  2.  
  3.         # Write conf. is off, until its turned on
  4.         write_conf = False
  5.  
  6.         try:
  7.             self.Parser.get(section, option)
  8.        
  9.         except ConfigParser.NoSectionError:
  10.             self.Parser.add_section(section)
  11.             write_conf = True
  12.  
  13.         except ConfigParser.NoOptionError:
  14.             self.Parser.set(section, option, 'test')
  15.             write_conf = True
  16.  
  17.         finally:
  18.             if write_conf == True:
  19.                 # write conf. if its needed
  20.                 self._write_conf()
  21.  
  22.                 try:
  23.                     self.__conf_load += 1
  24.                 except:
  25.                     self.__conf_load  = 1
  26.                 finally:
  27.                     # repeat own function if max write times is not reached
  28.                     if not self.__conf_load > Settings.MaxConfLoads:
  29.                         print 'load time : ' + `self.__conf_load`
  30.                         self._load_conf(section, option)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement