schema.py
changeset 2526 40e41eb34a7d
parent 2476 1294a6bdf3bf
child 2531 531ea4e7013e
equal deleted inserted replaced
2525:19eaaf9aebf2 2526:40e41eb34a7d
    19 
    19 
    20 from yams import BadSchemaDefinition, buildobjs as ybo, constraints
    20 from yams import BadSchemaDefinition, buildobjs as ybo, constraints
    21 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema
    21 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema
    22 from yams.constraints import BaseConstraint, StaticVocabularyConstraint
    22 from yams.constraints import BaseConstraint, StaticVocabularyConstraint
    23 from yams.reader import CONSTRAINTS, PyFileReader, SchemaLoader, \
    23 from yams.reader import CONSTRAINTS, PyFileReader, SchemaLoader, \
    24      obsolete as yobsolete
    24      obsolete as yobsolete, cleanup_sys_modules
    25 
    25 
    26 from rql import parse, nodes, RQLSyntaxError, TypeResolverException
    26 from rql import parse, nodes, RQLSyntaxError, TypeResolverException
    27 
    27 
    28 from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized
    28 from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized
    29 from cubicweb import set_log_methods
    29 from cubicweb import set_log_methods
   866         self.info('loading %s schemas', ', '.join(config.cubes()))
   866         self.info('loading %s schemas', ', '.join(config.cubes()))
   867         if config.apphome:
   867         if config.apphome:
   868             path = reversed([config.apphome] + config.cubes_path())
   868             path = reversed([config.apphome] + config.cubes_path())
   869         else:
   869         else:
   870             path = reversed(config.cubes_path())
   870             path = reversed(config.cubes_path())
   871         return super(CubicWebSchemaLoader, self).load(config, path=path, **kwargs)
   871         try:
       
   872             return super(CubicWebSchemaLoader, self).load(config, path=path, **kwargs)
       
   873         finally:
       
   874             # we've to cleanup modules imported from cubicweb.schemas as well
       
   875             cleanup_sys_modules([self.lib_directory])
   872 
   876 
   873     def _load_definition_files(self, cubes):
   877     def _load_definition_files(self, cubes):
   874         for filepath in (join(self.lib_directory, 'bootstrap.py'),
   878         for filepath in (join(self.lib_directory, 'bootstrap.py'),
   875                          join(self.lib_directory, 'base.py'),
   879                          join(self.lib_directory, 'base.py'),
   876                          join(self.lib_directory, 'workflow.py'),
   880                          join(self.lib_directory, 'workflow.py'),