schema.py
changeset 2730 bb6fcb8c5d71
parent 2718 3a56b87bb5d6
child 2735 39c942241b48
equal deleted inserted replaced
2729:d3dbd135f319 2730:bb6fcb8c5d71
    12 from os.path import join
    12 from os.path import join
    13 from logging import getLogger
    13 from logging import getLogger
    14 from warnings import warn
    14 from warnings import warn
    15 
    15 
    16 from logilab.common.decorators import cached, clear_cache, monkeypatch
    16 from logilab.common.decorators import cached, clear_cache, monkeypatch
       
    17 from logilab.common.logging_ext import set_log_methods
    17 from logilab.common.deprecation import deprecated
    18 from logilab.common.deprecation import deprecated
    18 from logilab.common.compat import any
    19 from logilab.common.compat import any
    19 
    20 
    20 from yams import BadSchemaDefinition, buildobjs as ybo
    21 from yams import BadSchemaDefinition, buildobjs as ybo
    21 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema
    22 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema
    24 from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader,
    25 from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader,
    25                          obsolete as yobsolete, cleanup_sys_modules)
    26                          obsolete as yobsolete, cleanup_sys_modules)
    26 
    27 
    27 from rql import parse, nodes, RQLSyntaxError, TypeResolverException
    28 from rql import parse, nodes, RQLSyntaxError, TypeResolverException
    28 
    29 
       
    30 import cubicweb
    29 from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized
    31 from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized
    30 from cubicweb import set_log_methods
       
    31 
    32 
    32 # XXX <3.2 bw compat
    33 # XXX <3.2 bw compat
    33 from yams import schema
    34 from yams import schema
    34 schema.use_py_datetime()
    35 schema.use_py_datetime()
    35 nodes.use_py_datetime()
    36 nodes.use_py_datetime()
   847 
   848 
   848     def load(self, config, path=(), **kwargs):
   849     def load(self, config, path=(), **kwargs):
   849         """return a Schema instance from the schema definition read
   850         """return a Schema instance from the schema definition read
   850         from <directory>
   851         from <directory>
   851         """
   852         """
   852         self.lib_directory = config.schemas_lib_dir()
   853         self.lib_directory = join(cubicweb.CW_SOFTWARE_ROOT, 'schemas')
   853         return super(BootstrapSchemaLoader, self).load(
   854         return super(BootstrapSchemaLoader, self).load(
   854             path, config.appid, register_base_types=False, **kwargs)
   855             path, config.appid, register_base_types=False, **kwargs)
   855 
   856 
   856     def _load_definition_files(self, cubes=None):
   857     def _load_definition_files(self, cubes=None):
   857         # bootstraping, ignore cubes
   858         # bootstraping, ignore cubes