# HG changeset patch # User RĂ©mi Cardona # Date 1410523803 -7200 # Node ID 8cdcbf3f4fd0062217240cabcacefffe6a9f7dee # Parent 3e5addc72575984e246f4a5e64e76ef1323f41d8 [schema] add utility function to build a CubicWebSchema from a namespace Will be useful for testing computed attributes and relations. diff -r 3e5addc72575 -r 8cdcbf3f4fd0 __pkginfo__.py --- a/__pkginfo__.py Thu Aug 28 18:12:28 2014 +0200 +++ b/__pkginfo__.py Fri Sep 12 14:10:03 2014 +0200 @@ -42,7 +42,7 @@ 'logilab-common': '>= 0.60.0', 'logilab-mtconverter': '>= 0.8.0', 'rql': '>= 0.31.2', - 'yams': '>= 0.39.1', + 'yams': '>= 0.40.0', #gettext # for xgettext, msgcat, etc... # web dependencies 'lxml': '', diff -r 3e5addc72575 -r 8cdcbf3f4fd0 cubicweb.spec --- a/cubicweb.spec Thu Aug 28 18:12:28 2014 +0200 +++ b/cubicweb.spec Fri Sep 12 14:10:03 2014 +0200 @@ -23,7 +23,7 @@ Requires: %{python}-logilab-common >= 0.60.0 Requires: %{python}-logilab-mtconverter >= 0.8.0 Requires: %{python}-rql >= 0.31.2 -Requires: %{python}-yams >= 0.39.1 +Requires: %{python}-yams >= 0.40.0 Requires: %{python}-logilab-database >= 1.12.1 Requires: %{python}-passlib Requires: %{python}-lxml diff -r 3e5addc72575 -r 8cdcbf3f4fd0 debian/control --- a/debian/control Thu Aug 28 18:12:28 2014 +0200 +++ b/debian/control Fri Sep 12 14:10:03 2014 +0200 @@ -15,7 +15,7 @@ python-unittest2 | python (>= 2.7), python-logilab-mtconverter, python-rql, - python-yams (>= 0.39.1), + python-yams (>= 0.40.0), python-lxml, Standards-Version: 3.9.1 Homepage: http://www.cubicweb.org @@ -152,7 +152,7 @@ gettext, python-logilab-mtconverter (>= 0.8.0), python-logilab-common (>= 0.60.0), - python-yams (>= 0.39.1), + python-yams (>= 0.40.0), python-rql (>= 0.31.2), python-lxml Recommends: diff -r 3e5addc72575 -r 8cdcbf3f4fd0 schema.py --- a/schema.py Thu Aug 28 18:12:28 2014 +0200 +++ b/schema.py Fri Sep 12 14:10:03 2014 +0200 @@ -37,7 +37,8 @@ RelationDefinitionSchema, PermissionMixIn, role_name from yams.constraints import BaseConstraint, FormatConstraint from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader, - obsolete as yobsolete, cleanup_sys_modules) + obsolete as yobsolete, cleanup_sys_modules, + fill_schema_from_namespace) from rql import parse, nodes, RQLSyntaxError, TypeResolverException @@ -106,6 +107,11 @@ ybo.ETYPE_PROPERTIES += ('eid',) ybo.RTYPE_PROPERTIES += ('eid',) +def build_schema_from_namespace(items): + schema = CubicWebSchema('noname') + fill_schema_from_namespace(schema, items, register_base_types=False) + return schema + # Bases for manipulating RQL in schema ######################################### def guess_rrqlexpr_mainvars(expression):