[multi-sources-removal] Simplify repo.delete_info_multi arguments, uri is no more used
Related to #2919300
--- a/server/migractions.py Tue Jan 21 18:20:28 2014 +0100
+++ b/server/migractions.py Mon Jun 17 00:15:51 2013 +0200
@@ -999,7 +999,7 @@
hook.CleanupDeletedEidsCacheOp.get_instance(session).union(thispending)
# and don't forget to remove record from system tables
entities = [session.entity_from_eid(eid, rdeftype) for eid in thispending]
- self.repo.system_source.delete_info_multi(session, entities, 'system')
+ self.repo.system_source.delete_info_multi(session, entities)
self.sqlexec('DELETE FROM cw_%s WHERE cw_from_entity=%%(eid)s OR '
'cw_to_entity=%%(eid)s' % rdeftype,
{'eid': oldeid}, ask_confirm=False)
--- a/server/repository.py Tue Jan 21 18:20:28 2014 +0100
+++ b/server/repository.py Mon Jun 17 00:15:51 2013 +0200
@@ -1111,7 +1111,7 @@
self._type_source_cache.pop(eid, None)
if 'entity' in locals():
hook.CleanupDeletedEidsCacheOp.get_instance(session).add_data(entity.eid)
- self.system_source.delete_info_multi(session, [entity], uri)
+ self.system_source.delete_info_multi(session, [entity])
if source.should_call_hooks:
session._tx.pending_operations = pending_operations
raise
@@ -1181,9 +1181,9 @@
raise
self.exception('error while cascading delete for entity %s '
'from %s. RQL: %s', entity, sourceuri, rql)
- self.system_source.delete_info_multi(session, [entity], sourceuri)
+ self.system_source.delete_info_multi(session, [entity])
- def _delete_info_multi(self, session, entities, sourceuri, scleanup=None):
+ def _delete_info_multi(self, session, entities, scleanup=None):
"""same as _delete_info but accepts a list of entities with
the same etype and belinging to the same source.
"""
@@ -1219,16 +1219,16 @@
except ValidationError:
raise
except Unauthorized:
- self.exception('Unauthorized exception while cascading delete for entity %s '
- 'from %s. RQL: %s.\nThis should not happen since security is disabled here.',
- entities, sourceuri, rql)
+ self.exception('Unauthorized exception while cascading delete for entity %s. '
+ 'RQL: %s.\nThis should not happen since security is disabled here.',
+ entities, rql)
raise
except Exception:
if self.config.mode == 'test':
raise
- self.exception('error while cascading delete for entity %s '
- 'from %s. RQL: %s', entities, sourceuri, rql)
- self.system_source.delete_info_multi(session, entities, sourceuri)
+ self.exception('error while cascading delete for entity %s. RQL: %s',
+ entities, rql)
+ self.system_source.delete_info_multi(session, entities)
def locate_relation_source(self, session, subject, rtype, object):
subjsource = self.source_from_eid(subject, session)
@@ -1431,9 +1431,9 @@
self.hm.call_hooks('before_delete_entity', session, entities=entities)
if session.deleted_in_transaction(source.eid):
# source is being deleted, think to give scleanup argument
- self._delete_info_multi(session, entities, sourceuri, scleanup=source.eid)
+ self._delete_info_multi(session, entities, scleanup=source.eid)
else:
- self._delete_info_multi(session, entities, sourceuri)
+ self._delete_info_multi(session, entities)
source.delete_entities(session, entities)
if source.should_call_hooks:
self.hm.call_hooks('after_delete_entity', session, entities=entities)
--- a/server/sources/__init__.py Tue Jan 21 18:20:28 2014 +0100
+++ b/server/sources/__init__.py Mon Jun 17 00:15:51 2013 +0200
@@ -464,12 +464,6 @@
"""mark entity as being modified, fulltext reindex if needed"""
raise NotImplementedError(self)
- def delete_info_multi(self, session, entities, uri):
- """delete system information on deletion of a list of entities with the
- same etype and belinging to the same source
- """
- raise NotImplementedError(self)
-
def index_entity(self, session, entity):
"""create an operation to [re]index textual content of the given entity
on commit
--- a/server/sources/native.py Tue Jan 21 18:20:28 2014 +0100
+++ b/server/sources/native.py Mon Jun 17 00:15:51 2013 +0200
@@ -985,7 +985,7 @@
# one indexable attribute
self.index_entity(session, entity=entity)
- def delete_info_multi(self, session, entities, uri):
+ def delete_info_multi(self, session, entities):
"""delete system information on deletion of a list of entities with the
same etype and belinging to the same source
@@ -1305,7 +1305,7 @@
sql = self.sqlgen.delete(SQL_PREFIX + entity.cw_etype, attrs)
self.doexec(session, sql, attrs)
# remove record from entities (will update fti if needed)
- self.delete_info_multi(session, [entity], self.uri)
+ self.delete_info_multi(session, [entity])
self.repo.hm.call_hooks('after_delete_entity', session, entity=entity)
return ()