__init__.py
changeset 10665 79ff784cd8af
parent 10616 f454404733c1
child 10680 1b4df4b3cd9a
--- a/__init__.py	Fri Sep 18 18:04:05 2015 +0200
+++ b/__init__.py	Fri Sep 11 18:01:36 2015 +0200
@@ -28,12 +28,8 @@
                         module='.*pygments')
 
 
-import __builtin__
-from six import PY2, binary_type
-# '_' is available in builtins to mark internationalized string but should
-# not be used to do the actual translation
-if not hasattr(__builtin__, '_'):
-    __builtin__._ = unicode
+from six import PY2, binary_type, text_type
+from six.moves import builtins
 
 CW_SOFTWARE_ROOT = __path__[0]
 
@@ -58,6 +54,14 @@
 from cubicweb._exceptions import *
 from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound
 
+
+# '_' is available to mark internationalized string but should not be used to
+# do the actual translation
+_ = text_type
+if not hasattr(builtins, '_'):
+    builtins._ = deprecated("[3.22] Use 'from cubicweb import _'")(_)
+
+
 # convert eid to the right type, raise ValueError if it's not a valid eid
 @deprecated('[3.17] typed_eid() was removed. replace it with int() when needed.')
 def typed_eid(eid):