fix failures introduced by recent refactoring
* * *
[testlib, realdb] we should close connections prior to create a new db using current db as template
--- a/server/repository.py Tue Jun 14 22:54:20 2011 +0200
+++ b/server/repository.py Tue Jun 14 22:54:25 2011 +0200
@@ -34,6 +34,7 @@
import sys
import threading
import Queue
+from warnings import warn
from itertools import chain
from os.path import join
from datetime import datetime
@@ -1228,7 +1229,7 @@
rdef = session.rtype_eids_rdef(attr, entity.eid, value)
if rdef.cardinality[1] in '1?' and activintegrity:
with security_enabled(session, read=False):
- session.execute('DELETE X %s Y WHERE Y eid %(y)s',
+ session.execute('DELETE X %s Y WHERE Y eid %%(y)s' % attr,
{'x': entity.eid, 'y': value})
edited.set_defaults()
if session.is_hook_category_activated('integrity'):
@@ -1338,6 +1339,10 @@
# operation (register pending eids before actual deletion to avoid
# multiple call to glob_delete_entities)
op = hook.CleanupDeletedEidsCacheOp.get_instance(session)
+ if not isinstance(eids, (set, frozenset)):
+ warn('[3.13] eids should be given as a set', DeprecationWarning,
+ stacklevel=2)
+ eids = frozenset(eids)
eids = eids - op._container
op._container |= eids
data_by_etype_source = {} # values are ([list of eids],
--- a/server/sources/native.py Tue Jun 14 22:54:20 2011 +0200
+++ b/server/sources/native.py Tue Jun 14 22:54:25 2011 +0200
@@ -1303,7 +1303,7 @@
sql = self.sqlgen.delete(SQL_PREFIX + entity.__regid__, attrs)
self.doexec(session, sql, attrs)
# remove record from entities (will update fti if needed)
- self.delete_info(session, entity, self.uri, None)
+ self.delete_info_multi(session, [entity], self.uri)
self.repo.hm.call_hooks('after_delete_entity', session, entity=entity)
return ()