VirtualMailManager/config.py
changeset 611 8e9b0046bc8f
parent 568 14abdd04ddf5
child 638 0de0b9e75c9f
child 675 d24f094d1cb5
equal deleted inserted replaced
610:b6c4e77046b9 611:8e9b0046bc8f
   140         if section in self._sections:  # check if the section was parsed
   140         if section in self._sections:  # check if the section was parsed
   141             sect = self._sections[section]
   141             sect = self._sections[section]
   142         elif not section in self._cfg:
   142         elif not section in self._cfg:
   143             raise NoSectionError(section)
   143             raise NoSectionError(section)
   144         else:
   144         else:
   145             return ((k, self._cfg[section][k].default) \
   145             return ((k, self._cfg[section][k].default)
   146                     for k in self._cfg[section].iterkeys())
   146                     for k in self._cfg[section].iterkeys())
   147         # still here? Get defaults and merge defaults with configured setting
   147         # still here? Get defaults and merge defaults with configured setting
   148         defaults = dict((k, self._cfg[section][k].default) \
   148         defaults = dict((k, self._cfg[section][k].default)
   149                         for k in self._cfg[section].iterkeys())
   149                         for k in self._cfg[section].iterkeys())
   150         defaults.update(sect)
   150         defaults.update(sect)
   151         if '__name__' in defaults:
   151         if '__name__' in defaults:
   152             del defaults['__name__']
   152             del defaults['__name__']
   153         return defaults.iteritems()
   153         return defaults.iteritems()
   433     def _chk_possible_values(self, miss_vers):
   433     def _chk_possible_values(self, miss_vers):
   434         """Check settings for which the possible values are known."""
   434         """Check settings for which the possible values are known."""
   435         if not miss_vers:
   435         if not miss_vers:
   436             value = self.get('misc', 'dovecot_version')
   436             value = self.get('misc', 'dovecot_version')
   437             if not VERSION_RE.match(value):
   437             if not VERSION_RE.match(value):
   438                 self._missing['misc'] = ['version: ' +\
   438                 self._missing['misc'] = ['version: ' +
   439                         _(u"Not a valid Dovecot version: '%s'") % value]
   439                         _(u"Not a valid Dovecot version: '%s'") % value]
   440         # section database
   440         # section database
   441         db_err = []
   441         db_err = []
   442         value = self.dget('database.module').lower()
   442         value = self.dget('database.module').lower()
   443         if value not in DB_MODULES:
   443         if value not in DB_MODULES:
   444             db_err.append('module: ' + \
   444             db_err.append('module: ' +
   445                           _(u"Unsupported database module: '%s'") % value)
   445                           _(u"Unsupported database module: '%s'") % value)
   446         if value == 'psycopg2':
   446         if value == 'psycopg2':
   447             value = self.dget('database.sslmode')
   447             value = self.dget('database.sslmode')
   448             if value not in DB_SSL_MODES:
   448             if value not in DB_SSL_MODES:
   449                 db_err.append('sslmode: ' + \
   449                 db_err.append('sslmode: ' +
   450                               _(u"Unknown pgsql SSL mode: '%s'") % value)
   450                               _(u"Unknown pgsql SSL mode: '%s'") % value)
   451         if db_err:
   451         if db_err:
   452             self._missing['database'] = db_err
   452             self._missing['database'] = db_err
   453         # section mailbox
   453         # section mailbox
   454         value = self.dget('mailbox.format')
   454         value = self.dget('mailbox.format')
   455         if not known_format(value):
   455         if not known_format(value):
   456             self._missing['mailbox'] = ['format: ' +\
   456             self._missing['mailbox'] = ['format: ' +
   457                               _(u"Unsupported mailbox format: '%s'") % value]
   457                               _(u"Unsupported mailbox format: '%s'") % value]
   458         # section domain
   458         # section domain
   459         try:
   459         try:
   460             value = self.dget('domain.quota_bytes')
   460             value = self.dget('domain.quota_bytes')
   461         except (ValueError, TypeError), err:
   461         except (ValueError, TypeError), err: