35 from yams import BadSchemaDefinition, buildobjs as ybo |
35 from yams import BadSchemaDefinition, buildobjs as ybo |
36 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema, \ |
36 from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema, \ |
37 RelationDefinitionSchema, PermissionMixIn, role_name |
37 RelationDefinitionSchema, PermissionMixIn, role_name |
38 from yams.constraints import BaseConstraint, FormatConstraint |
38 from yams.constraints import BaseConstraint, FormatConstraint |
39 from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader, |
39 from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader, |
40 obsolete as yobsolete, cleanup_sys_modules) |
40 obsolete as yobsolete, cleanup_sys_modules, |
|
41 fill_schema_from_namespace) |
41 |
42 |
42 from rql import parse, nodes, RQLSyntaxError, TypeResolverException |
43 from rql import parse, nodes, RQLSyntaxError, TypeResolverException |
43 |
44 |
44 import cubicweb |
45 import cubicweb |
45 from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized |
46 from cubicweb import ETYPE_NAME_MAP, ValidationError, Unauthorized |
103 _LOGGER = getLogger('cubicweb.schemaloader') |
104 _LOGGER = getLogger('cubicweb.schemaloader') |
104 |
105 |
105 # entity and relation schema created from serialized schema have an eid |
106 # entity and relation schema created from serialized schema have an eid |
106 ybo.ETYPE_PROPERTIES += ('eid',) |
107 ybo.ETYPE_PROPERTIES += ('eid',) |
107 ybo.RTYPE_PROPERTIES += ('eid',) |
108 ybo.RTYPE_PROPERTIES += ('eid',) |
|
109 |
|
110 def build_schema_from_namespace(items): |
|
111 schema = CubicWebSchema('noname') |
|
112 fill_schema_from_namespace(schema, items, register_base_types=False) |
|
113 return schema |
108 |
114 |
109 # Bases for manipulating RQL in schema ######################################### |
115 # Bases for manipulating RQL in schema ######################################### |
110 |
116 |
111 def guess_rrqlexpr_mainvars(expression): |
117 def guess_rrqlexpr_mainvars(expression): |
112 defined = set(split_expression(expression)) |
118 defined = set(split_expression(expression)) |