VMM/{Config,Handler}: moved Config.install() to Handler.cfg_install(). v0.6.x
authorPascal Volk <neverseen@users.sourceforge.net>
Fri, 30 Apr 2010 00:01:15 +0000
branchv0.6.x
changeset 280 db35d2eec518
parent 279 74d94b867348
child 281 59ff7c719697
VMM/{Config,Handler}: moved Config.install() to Handler.cfg_install(). Handler.cfg_install() must be called explicitly. To avoid 'strange' problems.
VirtualMailManager/Config.py
VirtualMailManager/Handler.py
--- a/VirtualMailManager/Config.py	Thu Apr 29 23:03:24 2010 +0000
+++ b/VirtualMailManager/Config.py	Fri Apr 30 00:01:15 2010 +0000
@@ -393,13 +393,6 @@
         value to an int."""
         return version_hex(self.get(section, option))
 
-    def install(self):
-        """Installs the dget() method as ``cfg_dget`` in the built-in
-        namespace."""
-        import __builtin__
-        assert 'cfg_dget' not in __builtin__.__dict__
-        __builtin__.__dict__['cfg_dget'] = self.dget
-
     def known_scheme(self, scheme):
         """Converts `scheme` to upper case and checks if is known by
         Dovecot (listed in VirtualMailManager.SCHEMES).
--- a/VirtualMailManager/Handler.py	Thu Apr 29 23:03:24 2010 +0000
+++ b/VirtualMailManager/Handler.py	Fri Apr 30 00:01:15 2010 +0000
@@ -74,7 +74,6 @@
             self._chkenv()
             # will be moved to the Alias module
             #self._postconf = Postconf(self._Cfg.dget('bin.postconf'))
-        self._Cfg.install()
 
     def __findCfgFile(self):
         for path in ['/root', '/usr/local/etc', '/etc']:
@@ -345,6 +344,13 @@
         """Get the configured value of the *option* (section.option)."""
         return self._Cfg.pget(option)
 
+    def cfg_install(self):
+        """Installs the cfg_dget method as ``cfg_dget`` into the built-in
+        namespace."""
+        import __builtin__
+        assert 'cfg_dget' not in __builtin__.__dict__
+        __builtin__.__dict__['cfg_dget'] = self._Cfg.dget
+
     def domainAdd(self, domainname, transport=None):
         dom = self.__getDomain(domainname)
         if transport is None: