Drop deprecated code in cubicweb.entities
Also dropped an unused import along the way.
Changelog entry will come in a later changeset.
--- a/cubicweb/entities/__init__.py Thu Mar 14 14:45:18 2019 +0100
+++ b/cubicweb/entities/__init__.py Thu Mar 14 14:45:27 2019 +0100
@@ -17,14 +17,9 @@
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
"""base application's entities class implementation: `AnyEntity`"""
-
-
-from warnings import warn
-
from six import text_type, string_types
from logilab.common.decorators import classproperty
-from logilab.common.deprecation import deprecated
from cubicweb import Unauthorized
from cubicweb.entity import Entity
@@ -47,36 +42,11 @@
return req.build_url('add/%s' % cls.__regid__, **kwargs)
@classmethod
- @deprecated('[3.22] use cw_fti_index_rql_limit instead')
- def cw_fti_index_rql_queries(cls, req):
- """return the list of rql queries to fetch entities to FT-index
-
- The default is to fetch all entities at once and to prefetch
- indexable attributes but one could imagine iterating over
- "smaller" resultsets if the table is very big or returning
- a subset of entities that match some business-logic condition.
- """
- restrictions = ['X is %s' % cls.__regid__]
- selected = ['X']
- for attrschema in sorted(cls.e_schema.indexable_attributes()):
- varname = attrschema.type.upper()
- restrictions.append('X %s %s' % (attrschema, varname))
- selected.append(varname)
- return ['Any %s WHERE %s' % (', '.join(selected),
- ', '.join(restrictions))]
-
- @classmethod
def cw_fti_index_rql_limit(cls, req, limit=1000):
"""generate rsets of entities to FT-index
By default, each successive result set is limited to 1000 entities
"""
- if cls.cw_fti_index_rql_queries.__func__ != AnyEntity.cw_fti_index_rql_queries.__func__:
- warn("[3.22] cw_fti_index_rql_queries is replaced by cw_fti_index_rql_limit",
- DeprecationWarning)
- for rql in cls.cw_fti_index_rql_queries(req):
- yield req.execute(rql)
- return
restrictions = ['X is %s' % cls.__regid__]
selected = ['X']
start = 0
--- a/cubicweb/entities/test/unittest_base.py Thu Mar 14 14:45:18 2019 +0100
+++ b/cubicweb/entities/test/unittest_base.py Thu Mar 14 14:45:27 2019 +0100
@@ -21,7 +21,6 @@
from logilab.common.testlib import unittest_main
from logilab.common.decorators import clear_cache
-from logilab.common.registry import yes
from cubicweb.devtools.testlib import CubicWebTC
@@ -65,33 +64,13 @@
{'description_format': ('format', 'description')})
def test_fti_rql_method(self):
- class EmailAddress(AnyEntity):
- __regid__ = 'EmailAddress'
- __select__ = AnyEntity.__select__ & yes(2)
-
- @classmethod
- def cw_fti_index_rql_queries(cls, req):
- return ['EmailAddress Y']
-
with self.admin_access.web_request() as req:
req.create_entity('EmailAddress', address=u'foo@bar.com')
eclass = self.vreg['etypes'].etype_class('EmailAddress')
- # deprecated
- self.assertEqual(['Any X, ADDRESS, ALIAS WHERE X is EmailAddress, '
- 'X address ADDRESS, X alias ALIAS'],
- eclass.cw_fti_index_rql_queries(req))
-
self.assertEqual(['Any X, ADDRESS, ALIAS ORDERBY X LIMIT 1000 WHERE X is EmailAddress, '
'X address ADDRESS, X alias ALIAS, X eid > 0'],
[rset.rql for rset in eclass.cw_fti_index_rql_limit(req)])
- # test backwards compatibility with custom method
- with self.temporary_appobjects(EmailAddress):
- self.vreg['etypes'].clear_caches()
- eclass = self.vreg['etypes'].etype_class('EmailAddress')
- self.assertEqual(['EmailAddress Y'],
- [rset.rql for rset in eclass.cw_fti_index_rql_limit(req)])
-
class EmailAddressTC(BaseEntityTC):
--- a/cubicweb/entities/wfobjs.py Thu Mar 14 14:45:18 2019 +0100
+++ b/cubicweb/entities/wfobjs.py Thu Mar 14 14:45:27 2019 +0100
@@ -28,7 +28,6 @@
from six import text_type, string_types
from logilab.common.decorators import cached, clear_cache
-from logilab.common.deprecation import deprecated
from cubicweb.entities import AnyEntity, fetch_config
from cubicweb.view import EntityAdapter