author | Pascal Volk <neverseen@users.sourceforge.net> |
Thu, 10 Nov 2011 00:01:08 +0000 | |
branch | v0.6.x |
changeset 475 | e321b764268e |
parent 457 | 2019aa415dcd |
child 568 | 14abdd04ddf5 |
permissions | -rw-r--r-- |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
1 |
# -*- coding: UTF-8 -*- |
366
d6573da35b5f
Updated copyright notices to include the year 2011.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
320
diff
changeset
|
2 |
# Copyright (c) 2007 - 2011, Pascal Volk |
0
bb0aa2102206
Initial import @sf.net
Pascal Volk <neverseen@users.sourceforge.net>
parents:
diff
changeset
|
3 |
# See COPYING for distribution information. |
209
c705a9e38962
VMM{/Config}: reduced docstrings. Added doc to the repository.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
208
diff
changeset
|
4 |
""" |
c705a9e38962
VMM{/Config}: reduced docstrings. Added doc to the repository.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
208
diff
changeset
|
5 |
VirtualMailManager |
320
011066435e6f
VMM/*: Made all modules names lowercase, adjusted imports.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
316
diff
changeset
|
6 |
~~~~~~~~~~~~~~~~~~ |
209
c705a9e38962
VMM{/Config}: reduced docstrings. Added doc to the repository.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
208
diff
changeset
|
7 |
|
c705a9e38962
VMM{/Config}: reduced docstrings. Added doc to the repository.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
208
diff
changeset
|
8 |
VirtualMailManager package initialization code |
c705a9e38962
VMM{/Config}: reduced docstrings. Added doc to the repository.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
208
diff
changeset
|
9 |
""" |
138
617f27715b01
Reorganized module import.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
10 |
|
188
cf1b5f22dbd2
VMM/Handler: __init__ accepts now a config_type ('default'||'cli').
Pascal Volk <neverseen@users.sourceforge.net>
parents:
187
diff
changeset
|
11 |
import gettext |
138
617f27715b01
Reorganized module import.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
12 |
import locale |
457
2019aa415dcd
VMM: Show a warning when a unsupported locale setting was detected.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
366
diff
changeset
|
13 |
import sys |
138
617f27715b01
Reorganized module import.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
14 |
|
316
31d8931dc535
VMM/constants: Replaced the constants subpackage by a module.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
272
diff
changeset
|
15 |
from VirtualMailManager.constants import __author__, __date__, __version__ |
185
6e1ef32fbd82
VMM/*: Moved some methods from classes to modules __init__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
174
diff
changeset
|
16 |
|
6e1ef32fbd82
VMM/*: Moved some methods from classes to modules __init__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
174
diff
changeset
|
17 |
__all__ = [ |
6e1ef32fbd82
VMM/*: Moved some methods from classes to modules __init__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
174
diff
changeset
|
18 |
# version information from VERSION |
6e1ef32fbd82
VMM/*: Moved some methods from classes to modules __init__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
174
diff
changeset
|
19 |
'__author__', '__date__', '__version__', |
209
c705a9e38962
VMM{/Config}: reduced docstrings. Added doc to the repository.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
208
diff
changeset
|
20 |
# defined stuff |
272
446483386914
VMM/Config: Added method Config.install() -> global cfg_dget().
Pascal Volk <neverseen@users.sourceforge.net>
parents:
262
diff
changeset
|
21 |
'ENCODING', |
185
6e1ef32fbd82
VMM/*: Moved some methods from classes to modules __init__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
174
diff
changeset
|
22 |
] |
6e1ef32fbd82
VMM/*: Moved some methods from classes to modules __init__.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
174
diff
changeset
|
23 |
|
138
617f27715b01
Reorganized module import.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
24 |
|
152
3dbee02711cd
Ignore unsupported locale setting and silently fall back to 'C'.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
141
diff
changeset
|
25 |
# Try to set all of the locales according to the current |
3dbee02711cd
Ignore unsupported locale setting and silently fall back to 'C'.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
141
diff
changeset
|
26 |
# environment variables and get the character encoding. |
3dbee02711cd
Ignore unsupported locale setting and silently fall back to 'C'.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
141
diff
changeset
|
27 |
try: |
3dbee02711cd
Ignore unsupported locale setting and silently fall back to 'C'.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
141
diff
changeset
|
28 |
locale.setlocale(locale.LC_ALL, '') |
3dbee02711cd
Ignore unsupported locale setting and silently fall back to 'C'.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
141
diff
changeset
|
29 |
except locale.Error: |
457
2019aa415dcd
VMM: Show a warning when a unsupported locale setting was detected.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
366
diff
changeset
|
30 |
sys.stderr.write('warning: unsupported locale setting - ' |
2019aa415dcd
VMM: Show a warning when a unsupported locale setting was detected.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
366
diff
changeset
|
31 |
'that may cause encoding problems.\n\n') |
152
3dbee02711cd
Ignore unsupported locale setting and silently fall back to 'C'.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
141
diff
changeset
|
32 |
locale.setlocale(locale.LC_ALL, 'C') |
138
617f27715b01
Reorganized module import.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
33 |
ENCODING = locale.nl_langinfo(locale.CODESET) |
617f27715b01
Reorganized module import.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
102
diff
changeset
|
34 |
|
215
33f727efa7c4
PEP-8-ified the work of the last days.
Pascal Volk <neverseen@users.sourceforge.net>
parents:
209
diff
changeset
|
35 |
gettext.install('vmm', '/usr/local/share/locale', unicode=1) |