VirtualMailManager/Config.py
branchv0.6.x
changeset 178 9480f2b15129
parent 175 b241272eb1bd
child 180 f8279c90e99c
equal deleted inserted replaced
177:ec2e1df8bb10 178:9480f2b15129
   138         if not sect_opt[1] in self._cfg[sect_opt[0]]:
   138         if not sect_opt[1] in self._cfg[sect_opt[0]]:
   139             raise NoOptionError(sect_opt[1], sect_opt[0])
   139             raise NoOptionError(sect_opt[1], sect_opt[0])
   140         return sect_opt
   140         return sect_opt
   141 
   141 
   142     def items(self, section):
   142     def items(self, section):
   143         """returns a ``list`` with key, value ``tuples`` from the given
   143         """returns an iterable that returns key, value ``tuples`` from the
   144         ``section``: ``[(key, value), …]``"""
   144         given ``section``."""
   145         if section in self._sections:# check if the section was parsed
   145         if section in self._sections:# check if the section was parsed
   146             d2 = self._sections[section]
   146             d2 = self._sections[section]
   147         elif not section in self._cfg:
   147         elif not section in self._cfg:
   148             raise NoSectionError(section)
   148             raise NoSectionError(section)
   149         else:
   149         else:
   413         # then set changes true
   413         # then set changes true
   414         if not self.dget('config.done'):
   414         if not self.dget('config.done'):
   415             self._modified = True
   415             self._modified = True
   416         w_std(_(u'Using configuration file: %s\n') % self.__cfgFileName)
   416         w_std(_(u'Using configuration file: %s\n') % self.__cfgFileName)
   417         for s in sections:
   417         for s in sections:
   418             w_std(_(u'* Config section: “%s”') % s )
   418             w_std(_(u'* Configuration section: “%s”') % s )
   419             for opt, val in self.items(s):
   419             for opt, val in self.items(s):
   420                 failures = 0
   420                 failures = 0
   421                 while True:
   421                 while True:
   422                     newval = raw_input(input_fmt.encode(ENCODING,'replace') %{
   422                     newval = raw_input(input_fmt.encode(ENCODING,'replace') %{
   423                                        'option': opt, 'current_value': val})
   423                                        'option': opt, 'current_value': val})