VMM/Config: moved Config.sections() to class LazyConfig. v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Mon, 22 Feb 2010 03:14:12 +0000
branchv0.6.x
changeset 207 95be8f62bc0c
parent 206 da07dd944ad1
child 208 efa1327b721f
VMM/Config: moved Config.sections() to class LazyConfig. No longer import the ENCODING from VirtualMailManager, it's no longer required in the Config module.
VirtualMailManager/Config.py
--- a/VirtualMailManager/Config.py	Sat Feb 20 17:20:52 2010 +0000
+++ b/VirtualMailManager/Config.py	Mon Feb 22 03:14:12 2010 +0000
@@ -41,7 +41,7 @@
      ParsingError, RawConfigParser
 from cStringIO import StringIO# TODO: move interactive stff to cli
 
-from VirtualMailManager import ENCODING, exec_ok, get_unicode, is_dir
+from VirtualMailManager import exec_ok, get_unicode, is_dir
 from VirtualMailManager.constants.ERROR import CONF_ERROR
 from VirtualMailManager.Exceptions import VMMConfigException
 
@@ -226,6 +226,10 @@
         except(BadOptionError, NoSectionError, NoOptionError):
             return False
 
+    def sections(self):
+        """Returns an iterator object for all configuration sections."""
+        return self._cfg.iterkeys()
+
 
 class LazyConfigOption(object):
     """A simple container class for configuration settings.
@@ -384,10 +388,6 @@
                     errmsg.write((u'    %s\n') % option)
             raise VMMConfigException(errmsg.getvalue(), CONF_ERROR)
 
-    def sections(self):
-        """Returns an iterator object for all configuration sections."""
-        return self._cfg.iterkeys()
-
     def known_scheme(self, scheme):
         """Converts ``scheme`` to upper case and checks if is known by
         Dovecot (listed in VirtualMailManager.SCHEMES).
@@ -405,7 +405,7 @@
         return get_unicode(self.get(section, option))
 
     def __chkCfg(self):
-        """Checks all section's options for settings w/o default values.
+        """Checks all section's options for settings w/o a default value.
 
         Returns ``True`` if everything is fine, else ``False``."""
         errors = False