VirtualMailManager/__init__.py
branchv0.6.x
changeset 188 cf1b5f22dbd2
parent 187 38b9a9859749
child 199 0684790fff7c
equal deleted inserted replaced
187:38b9a9859749 188:cf1b5f22dbd2
     2 # Copyright (c) 2007 - 2010, Pascal Volk
     2 # Copyright (c) 2007 - 2010, Pascal Volk
     3 # See COPYING for distribution information.
     3 # See COPYING for distribution information.
     4 # package initialization code
     4 # package initialization code
     5 #
     5 #
     6 
     6 
       
     7 import gettext
     7 import os
     8 import os
     8 import re
     9 import re
     9 import locale
    10 import locale
    10 
    11 
    11 from encodings.idna import ToASCII, ToUnicode
    12 from encodings.idna import ToASCII, ToUnicode
    37 ENCODING = locale.nl_langinfo(locale.CODESET)
    38 ENCODING = locale.nl_langinfo(locale.CODESET)
    38 
    39 
    39 RE_ASCII_CHARS = """^[\x20-\x7E]*$"""
    40 RE_ASCII_CHARS = """^[\x20-\x7E]*$"""
    40 RE_DOMAIN = """^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$"""
    41 RE_DOMAIN = """^(?:[a-z0-9-]{1,63}\.){1,}[a-z]{2,6}$"""
    41 
    42 
       
    43 
       
    44 gettext.install('vmm', '/usr/local/share/locale', unicode=1)
    42 
    45 
    43 def get_unicode(string):
    46 def get_unicode(string):
    44     """Converts `string` to `unicode`, if necessary."""
    47     """Converts `string` to `unicode`, if necessary."""
    45     if isinstance(string, unicode):
    48     if isinstance(string, unicode):
    46         return string
    49         return string