diff -r 2e03bb4372b2 -r f09efeead7f9 cubicweb/__init__.py --- a/cubicweb/__init__.py Tue Jun 30 10:00:53 2015 +0200 +++ b/cubicweb/__init__.py Wed Nov 09 11:42:33 2016 +0100 @@ -29,24 +29,27 @@ import warnings import zlib -warnings.filterwarnings('ignore', category=UserWarning, - message='.*was already imported', - module='.*pygments') - - from six import PY2, binary_type, text_type from six.moves import builtins +from logilab.common.deprecation import deprecated +from logilab.common.logging_ext import set_log_methods +from yams.constraints import BASE_CONVERTERS, BASE_CHECKERS +from yams.schema import role_name as rname + +from cubicweb.__pkginfo__ import version as __version__ # noqa + +# make all exceptions accessible from the package +from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound # noqa +from yams import ValidationError +from cubicweb._exceptions import * # noqa + if PY2: # http://bugs.python.org/issue10211 from StringIO import StringIO as BytesIO else: from io import BytesIO -from logilab.common.deprecation import deprecated -from logilab.common.logging_ext import set_log_methods -from yams.constraints import BASE_CONVERTERS, BASE_CHECKERS - # ignore the pygments UserWarnings warnings.filterwarnings('ignore', category=UserWarning, message='.*was already imported', @@ -54,21 +57,12 @@ # pre python 2.7.2 safety logging.basicConfig() +set_log_methods(sys.modules[__name__], logging.getLogger('cubicweb')) # this is necessary for i18n devtools test where chdir is done while __path__ is relative, which # breaks later imports -__path__[0] = os.path.abspath(__path__[0]) -CW_SOFTWARE_ROOT = __path__[0] - - -from cubicweb.__pkginfo__ import version as __version__ # noqa - - -set_log_methods(sys.modules[__name__], logging.getLogger('cubicweb')) - -# make all exceptions accessible from the package -from cubicweb._exceptions import * # noqa -from logilab.common.registry import ObjectNotFound, NoSelectableObject, RegistryNotFound # noqa +__path__[0] = os.path.abspath(__path__[0]) # noqa +CW_SOFTWARE_ROOT = __path__[0] # noqa # '_' is available to mark internationalized string but should not be used to @@ -249,9 +243,6 @@ return _decorator -from yams.schema import role_name as rname - - def validation_error(entity, errors, substitutions=None, i18nvalues=None): """easy way to retrieve a :class:`cubicweb.ValidationError` for an entity or eid.