# HG changeset patch # User Julien Cristau # Date 1421336676 -3600 # Node ID cceb2c7c02f44c1a11c667287d2e4fa032991599 # Parent 218c28bff6956096fff9e1ca4ab40f194dbe0bd6 Use our version of schema2sql Related to #4846892 diff -r 218c28bff695 -r cceb2c7c02f4 hooks/syncschema.py --- a/hooks/syncschema.py Thu Jan 15 16:39:35 2015 +0100 +++ b/hooks/syncschema.py Thu Jan 15 16:44:36 2015 +0100 @@ -29,7 +29,7 @@ from copy import copy from yams.schema import (BASE_TYPES, BadSchemaDefinition, RelationSchema, RelationDefinitionSchema) -from yams import buildobjs as ybo, schema2sql as y2sql, convert_default_value +from yams import buildobjs as ybo, convert_default_value from logilab.common.decorators import clear_cache @@ -37,7 +37,7 @@ from cubicweb.predicates import is_instance from cubicweb.schema import (SCHEMA_TYPES, META_RTYPES, VIRTUAL_RTYPES, CONSTRAINTS, ETYPE_NAME_MAP, display_name) -from cubicweb.server import hook, schemaserial as ss +from cubicweb.server import hook, schemaserial as ss, schema2sql as y2sql from cubicweb.server.sqlutils import SQL_PREFIX from cubicweb.hooks.synccomputed import RecomputeAttributeOperation diff -r 218c28bff695 -r cceb2c7c02f4 misc/migration/3.14.4_Any.py --- a/misc/migration/3.14.4_Any.py Thu Jan 15 16:39:35 2015 +0100 +++ b/misc/migration/3.14.4_Any.py Thu Jan 15 16:44:36 2015 +0100 @@ -1,4 +1,4 @@ -from yams import schema2sql as y2sql +from cubicweb.server import schema2sql as y2sql dbhelper = repo.system_source.dbhelper rdefdef = schema['CWSource'].rdef('name') diff -r 218c28bff695 -r cceb2c7c02f4 server/migractions.py --- a/server/migractions.py Thu Jan 15 16:39:35 2015 +0100 +++ b/server/migractions.py Thu Jan 15 16:44:36 2015 +0100 @@ -44,7 +44,6 @@ from logilab.common.decorators import cached, clear_cache from yams.constraints import SizeConstraint -from yams.schema2sql import eschema2sql, rschema2sql, unique_index_name from yams.schema import RelationDefinitionSchema from cubicweb import CW_SOFTWARE_ROOT, AuthenticationError, ExecutionError @@ -56,6 +55,7 @@ from cubicweb import repoapi from cubicweb.migration import MigrationHelper, yes from cubicweb.server import hook, schemaserial as ss +from cubicweb.server.schema2sql import eschema2sql, rschema2sql, unique_index_name from cubicweb.server.utils import manager_userpasswd from cubicweb.server.sqlutils import sqlexec, SQL_PREFIX diff -r 218c28bff695 -r cceb2c7c02f4 server/schemaserial.py --- a/server/schemaserial.py Thu Jan 15 16:39:35 2015 +0100 +++ b/server/schemaserial.py Thu Jan 15 16:44:36 2015 +0100 @@ -24,13 +24,12 @@ from logilab.common.shellutils import ProgressBar -from yams import (BadSchemaDefinition, schema as schemamod, buildobjs as ybo, - schema2sql as y2sql) +from yams import BadSchemaDefinition, schema as schemamod, buildobjs as ybo from cubicweb import Binary from cubicweb.schema import (KNOWN_RPROPERTIES, CONSTRAINTS, ETYPE_NAME_MAP, VIRTUAL_RTYPES) -from cubicweb.server import sqlutils +from cubicweb.server import sqlutils, schema2sql as y2sql def group_mapping(cnx, interactive=True): diff -r 218c28bff695 -r cceb2c7c02f4 server/sources/native.py --- a/server/sources/native.py Thu Jan 15 16:39:35 2015 +0100 +++ b/server/sources/native.py Thu Jan 15 16:44:36 2015 +0100 @@ -43,7 +43,6 @@ from logilab.common.shellutils import getlogin from logilab.database import get_db_helper, sqlgen -from yams import schema2sql as y2sql from yams.schema import role_name from cubicweb import (UnknownEid, AuthenticationError, ValidationError, Binary, @@ -53,6 +52,7 @@ from cubicweb.schema import VIRTUAL_RTYPES from cubicweb.cwconfig import CubicWebNoAppConfiguration from cubicweb.server import hook +from cubicweb.server import schema2sql as y2sql from cubicweb.server.utils import crypt_password, eschema_eid, verify_and_update from cubicweb.server.sqlutils import SQL_PREFIX, SQLAdapterMixIn from cubicweb.server.rqlannotation import set_qdata diff -r 218c28bff695 -r cceb2c7c02f4 server/sqlutils.py --- a/server/sqlutils.py Thu Jan 15 16:39:35 2015 +0100 +++ b/server/sqlutils.py Thu Jan 15 16:44:36 2015 +0100 @@ -103,7 +103,7 @@ """return sql to give all access privileges to the given user on the system schema """ - from yams.schema2sql import grant_schema + from cubicweb.server.schema2sql import grant_schema from cubicweb.server.sources import native output = [] w = output.append @@ -121,7 +121,7 @@ user=None, set_owner=False, skip_relations=PURE_VIRTUAL_RTYPES, skip_entities=()): """return the system sql schema, according to the given parameters""" - from yams.schema2sql import schema2sql + from cubicweb.server.schema2sql import schema2sql from cubicweb.server.sources import native if set_owner: assert user, 'user is argument required when set_owner is true' @@ -146,7 +146,7 @@ def sqldropschema(schema, driver, text_index=True, skip_relations=PURE_VIRTUAL_RTYPES, skip_entities=()): """return the sql to drop the schema, according to the given parameters""" - from yams.schema2sql import dropschema2sql + from cubicweb.server.schema2sql import dropschema2sql from cubicweb.server.sources import native output = [] w = output.append diff -r 218c28bff695 -r cceb2c7c02f4 server/test/unittest_schema2sql.py --- a/server/test/unittest_schema2sql.py Thu Jan 15 16:39:35 2015 +0100 +++ b/server/test/unittest_schema2sql.py Thu Jan 15 16:44:36 2015 +0100 @@ -1,21 +1,21 @@ # copyright 2004-2014 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr # -# This file is part of yams. +# This file is part of CubicWeb. # -# yams is free software: you can redistribute it and/or modify it under the +# CubicWeb is free software: you can redistribute it and/or modify it under the # terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 2.1 of the License, or (at your option) # any later version. # -# yams is distributed in the hope that it will be useful, but WITHOUT ANY +# CubicWeb is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License along -# with yams. If not, see . -"""unit tests for module yams.schema2sql +# with CubicWeb. If not, see . +"""unit tests for module cubicweb.server.schema2sql """ import os.path as osp