VirtualMailManager/__init__.py
branchv0.6.x
changeset 272 446483386914
parent 262 6eea85d8b91d
child 316 31d8931dc535
equal deleted inserted replaced
271:e915d4725706 272:446483386914
    16 
    16 
    17 __all__ = [
    17 __all__ = [
    18     # version information from VERSION
    18     # version information from VERSION
    19     '__author__', '__date__', '__version__',
    19     '__author__', '__date__', '__version__',
    20     # defined stuff
    20     # defined stuff
    21     'ENCODING', 'Configuration', 'set_configuration',
    21     'ENCODING',
    22 ]
    22 ]
    23 
    23 
    24 
    24 
    25 # Try to set all of the locales according to the current
    25 # Try to set all of the locales according to the current
    26 # environment variables and get the character encoding.
    26 # environment variables and get the character encoding.
    28     locale.setlocale(locale.LC_ALL, '')
    28     locale.setlocale(locale.LC_ALL, '')
    29 except locale.Error:
    29 except locale.Error:
    30     locale.setlocale(locale.LC_ALL, 'C')
    30     locale.setlocale(locale.LC_ALL, 'C')
    31 ENCODING = locale.nl_langinfo(locale.CODESET)
    31 ENCODING = locale.nl_langinfo(locale.CODESET)
    32 
    32 
    33 Configuration = None
       
    34 
       
    35 gettext.install('vmm', '/usr/local/share/locale', unicode=1)
    33 gettext.install('vmm', '/usr/local/share/locale', unicode=1)
    36 
       
    37 
       
    38 def set_configuration(cfg_obj):
       
    39     """Assigns the *cfg_obj* to the global `Configuration`.
       
    40     *cfg_obj* has to be a `VirtualMailManager.Config.Config` instance."""
       
    41     from VirtualMailManager.Config import Config
       
    42     assert isinstance(cfg_obj, Config)
       
    43     global Configuration
       
    44     Configuration = cfg_obj