[schema] make cubicweb 3.14 compatible with yams 0.35 stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Mon, 20 Feb 2012 15:16:55 +0100
branchstable
changeset 8256 852c73392b00
parent 8255 25a00e4a8722
child 8257 d54fc706d623
[schema] make cubicweb 3.14 compatible with yams 0.35
schema.py
--- a/schema.py	Wed Feb 22 18:22:02 2012 +0100
+++ b/schema.py	Mon Feb 20 15:16:55 2012 +0100
@@ -27,7 +27,7 @@
 
 from logilab.common.decorators import cached, clear_cache, monkeypatch
 from logilab.common.logging_ext import set_log_methods
-from logilab.common.deprecation import deprecated, class_moved
+from logilab.common.deprecation import deprecated, class_moved, moved
 from logilab.common.textutils import splitstrip
 from logilab.common.graph import get_cycles
 from logilab.common.compat import any
@@ -1250,7 +1250,10 @@
 from yams.buildobjs import RichString
 from yams.constraints import StaticVocabularyConstraint
 
-RichString = class_moved(RichString)
+try: # for yams < 0.35
+    RichString = class_moved(RichString)
+except TypeError:
+    RichString = moved('yams.buildobjs', 'RichString')
 
 StaticVocabularyConstraint = class_moved(StaticVocabularyConstraint)
 FormatConstraint = class_moved(FormatConstraint)