__init__.py
changeset 10665 79ff784cd8af
parent 10616 f454404733c1
child 10680 1b4df4b3cd9a
equal deleted inserted replaced
10664:6465a3e9d7ac 10665:79ff784cd8af
    26 warnings.filterwarnings('ignore', category=UserWarning,
    26 warnings.filterwarnings('ignore', category=UserWarning,
    27                         message='.*was already imported',
    27                         message='.*was already imported',
    28                         module='.*pygments')
    28                         module='.*pygments')
    29 
    29 
    30 
    30 
    31 import __builtin__
    31 from six import PY2, binary_type, text_type
    32 from six import PY2, binary_type
    32 from six.moves import builtins
    33 # '_' is available in builtins to mark internationalized string but should
       
    34 # not be used to do the actual translation
       
    35 if not hasattr(__builtin__, '_'):
       
    36     __builtin__._ = unicode
       
    37 
    33 
    38 CW_SOFTWARE_ROOT = __path__[0]
    34 CW_SOFTWARE_ROOT = __path__[0]
    39 
    35 
    40 import sys, os, logging
    36 import sys, os, logging
    41 from io import BytesIO
    37 from io import BytesIO
    55 set_log_methods(sys.modules[__name__], logging.getLogger('cubicweb'))
    51 set_log_methods(sys.modules[__name__], logging.getLogger('cubicweb'))
    56 
    52 
    57 # make all exceptions accessible from the package
    53 # make all exceptions accessible from the package
    58 from cubicweb._exceptions import *
    54 from cubicweb._exceptions import *
    59 from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound
    55 from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound
       
    56 
       
    57 
       
    58 # '_' is available to mark internationalized string but should not be used to
       
    59 # do the actual translation
       
    60 _ = text_type
       
    61 if not hasattr(builtins, '_'):
       
    62     builtins._ = deprecated("[3.22] Use 'from cubicweb import _'")(_)
       
    63 
    60 
    64 
    61 # convert eid to the right type, raise ValueError if it's not a valid eid
    65 # convert eid to the right type, raise ValueError if it's not a valid eid
    62 @deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.')
    66 @deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.')
    63 def typed_eid(eid):
    67 def typed_eid(eid):
    64     return int(eid)
    68     return int(eid)