VirtualMailManager/__init__.py
branchv0.6.x
changeset 256 ae80282301a3
parent 254 8aecc83a0d32
child 262 6eea85d8b91d
--- a/VirtualMailManager/__init__.py	Sat Apr 17 21:39:00 2010 +0000
+++ b/VirtualMailManager/__init__.py	Sun Apr 18 15:42:46 2010 +0000
@@ -24,7 +24,8 @@
     # version information from VERSION
     '__author__', '__date__', '__version__',
     # defined stuff
-    'ENCODING', 'exec_ok', 'expand_path', 'get_unicode', 'is_dir',
+    'ENCODING', 'Configuration', 'exec_ok', 'expand_path', 'get_unicode',
+    'is_dir', 'set_configuration',
 ]
 
 
@@ -36,12 +37,23 @@
     locale.setlocale(locale.LC_ALL, 'C')
 ENCODING = locale.nl_langinfo(locale.CODESET)
 
+Configuration = None
+
 gettext.install('vmm', '/usr/local/share/locale', unicode=1)
 
 
 _ = lambda msg: msg
 
 
+def set_configuration(cfg_obj):
+    """Assigns the *cfg_obj* to the global `Configuration`.
+    *cfg_obj* has to be a `VirtualMailManager.Config.Config` instance."""
+    from VirtualMailManager.Config import Config
+    assert isinstance(cfg_obj, Config)
+    global Configuration
+    Configuration = cfg_obj
+
+
 def get_unicode(string):
     """Converts `string` to `unicode`, if necessary."""
     if isinstance(string, unicode):