Commit f9f1b4f7 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[dataimport, migration] silence find_entities / find_one_entity warning

Deprecate associated methods to unify the API
parent dbaf79418b8f
......@@ -620,11 +620,13 @@ class RQLObjectStore(ObjectStore):
self.rql('SET X %s Y WHERE X eid %%(x)s, Y eid %%(y)s' % rtype,
{'x': int(eid_from), 'y': int(eid_to)})
@deprecated("[3.19] use session.find(*args, **kwargs).entities() instead")
def find_entities(self, *args, **kwargs):
return self.session.find_entities(*args, **kwargs)
return self.session.find(*args, **kwargs).entities()
@deprecated("[3.19] use session.find(*args, **kwargs).one() instead")
def find_one_entity(self, *args, **kwargs):
return self.session.find_one_entity(*args, **kwargs)
return self.session.find(*args, **kwargs).one()
# the import controller ########################################################
......
......@@ -1342,17 +1342,23 @@ class ServerMigrationHelper(MigrationHelper):
self.commit()
return entity
def cmd_find(self, etype, **kwargs):
"""find entities of the given type and attribute values"""
return self.cnx.find(etype, **kwargs)
@deprecated("[3.19] use find(*args, **kwargs).entities() instead")
def cmd_find_entities(self, etype, **kwargs):
"""find entities of the given type and attribute values"""
return self.cnx.find_entities(etype, **kwargs)
return self.cnx.find(etype, **kwargs).entities()
@deprecated("[3.19] use find(*args, **kwargs).one() instead")
def cmd_find_one_entity(self, etype, **kwargs):
"""find one entity of the given type and attribute values.
raise :exc:`cubicweb.req.FindEntityError` if can not return one and only
one entity.
"""
return self.cnx.find_one_entity(etype, **kwargs)
return self.cnx.find(etype, **kwargs).one()
def cmd_update_etype_fti_weight(self, etype, weight):
if self.repo.system_source.dbdriver == 'postgres':
......
......@@ -467,7 +467,7 @@ class CWEntityXMLActionLink(CWEntityXMLActionCopy):
self._clear_relation((ttype,))
def _find_entities(self, item, kwargs):
return tuple(self._cw.find_entities(item['cwtype'], **kwargs))
return tuple(self._cw.find(item['cwtype'], **kwargs).entities())
class CWEntityXMLActionLinkInState(CWEntityXMLActionLink):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment