# HG changeset patch # User Sylvain Thénault # Date 1267186216 -3600 # Node ID 535705688f4f5519295215346c9ccf9f5772531a # Parent 55b6a32620711965abd50542eab18e541e553e07 proper deprecation warning when import class that should be imported from yams diff -r 55b6a3262071 -r 535705688f4f schema.py --- a/schema.py Fri Feb 26 13:09:12 2010 +0100 +++ b/schema.py Fri Feb 26 13:10:16 2010 +0100 @@ -15,15 +15,14 @@ from logilab.common.decorators import cached, clear_cache, monkeypatch from logilab.common.logging_ext import set_log_methods -from logilab.common.deprecation import deprecated +from logilab.common.deprecation import deprecated, class_moved from logilab.common.graph import get_cycles from logilab.common.compat import any from yams import BadSchemaDefinition, buildobjs as ybo from yams.schema import Schema, ERSchema, EntitySchema, RelationSchema, \ RelationDefinitionSchema, PermissionMixIn -from yams.constraints import (BaseConstraint, StaticVocabularyConstraint, - FormatConstraint) +from yams.constraints import BaseConstraint, FormatConstraint from yams.reader import (CONSTRAINTS, PyFileReader, SchemaLoader, obsolete as yobsolete, cleanup_sys_modules) @@ -766,7 +765,7 @@ rqlst.add_selected(objvar) else: colindex = selected.index(objvar.name) - found.append((action, objvar, colindex)) + found.append((action, colindex)) # remove U eid %(u)s if U is not used in any other relation uvrefs = rqlst.defined_vars['U'].references() if len(uvrefs) == 1: @@ -834,7 +833,7 @@ # check every special has_*_permission relation is satisfied get_eschema = session.vreg.schema.eschema try: - for eaction, var, col in has_perm_defs: + for eaction, col in has_perm_defs: for i in xrange(len(rset)): eschema = get_eschema(rset.description[i][col]) eschema.check_perm(session, eaction, eid=rset[i][col]) @@ -1091,6 +1090,12 @@ # XXX deprecated from yams.buildobjs import RichString +from yams.constraints import StaticVocabularyConstraint + +RichString = class_moved(RichString) + +StaticVocabularyConstraint = class_moved(StaticVocabularyConstraint) +FormatConstraint = class_moved(FormatConstraint) PyFileReader.context['ERQLExpression'] = yobsolete(ERQLExpression) PyFileReader.context['RRQLExpression'] = yobsolete(RRQLExpression)