[entities] fix compatibility with cubicweb 3.18 (closes #3433967) stable
authorJulien Cristau <julien.cristau@logilab.fr>
Mon, 13 Jan 2014 15:45:20 +0100
branchstable
changeset 152 69e5736fdc1e
parent 151 4cccff0c097a
child 153 c29ba186a7db
[entities] fix compatibility with cubicweb 3.18 (closes #3433967) The cubicweb.mixins and cubicweb.interfaces modules are gone, and entity.related_rql is called cw_related_rql. The `cw_related_rql` is available from cw 3.16.X. remove useless `ClassifiableMixIn`
__pkginfo__.py
entities.py
--- a/__pkginfo__.py	Mon May 12 11:09:43 2014 +0200
+++ b/__pkginfo__.py	Mon Jan 13 15:45:20 2014 +0100
@@ -53,7 +53,7 @@
     ]
 
 __depends_cubes__ = {}
-__depends__ = {'cubicweb': '>= 3.15.0'}
+__depends__ = {'cubicweb': '>= 3.16.0'}
 __use__ = tuple(__depends_cubes__)
 
 from os import listdir as _listdir
--- a/entities.py	Mon May 12 11:09:43 2014 +0200
+++ b/entities.py	Mon Jan 13 15:45:20 2014 +0100
@@ -8,9 +8,7 @@
 
 from logilab.common.deprecation import  deprecated
 
-from cubicweb.mixins import MI_REL_TRIGGERS, TreeMixIn
 from cubicweb.entities import AnyEntity, fetch_config, adapters
-from cubicweb.interfaces import ITree
 from cubicweb.view import EntityAdapter
 from cubicweb.predicates import is_instance
 
@@ -41,7 +39,7 @@
 
     def children_rql(self):
         """XXX returns RQL to get children"""
-        return self.entity.related_rql('included_in', 'object')
+        return self.entity.cw_related_rql('included_in', 'object')
 
     def is_leaf(self):
         """returns true if this node as no child"""
@@ -125,16 +123,3 @@
 
     def dc_title(self):
         return u'%s - %s' % (self.code, self.name)
-
-
-class ClassifiableMixIn(object):
-    """mixin automatically plugged to entity types supporting the applied_to
-    relation
-    """
-    def classification_keywords(self, name):
-        """return keywords of the given classification linked to this entity"""
-        return self.req.execute('Any K, KN WHERE K applied_to X, X eid %(x)s, '
-                                'K name KN, K included_in CS, CS name %(name)s',
-                                {'x': self.eid, 'name': name}, 'x')
-
-MI_REL_TRIGGERS[('applied_to', 'object')] = ClassifiableMixIn