32 __docformat__ = "restructuredtext en" |
32 __docformat__ = "restructuredtext en" |
33 |
33 |
34 import sys |
34 import sys |
35 import threading |
35 import threading |
36 import Queue |
36 import Queue |
|
37 from warnings import warn |
37 from itertools import chain |
38 from itertools import chain |
38 from os.path import join |
39 from os.path import join |
39 from datetime import datetime |
40 from datetime import datetime |
40 from time import time, localtime, strftime |
41 from time import time, localtime, strftime |
41 |
42 |
1226 relations.append((attr, value)) |
1227 relations.append((attr, value)) |
1227 session.update_rel_cache_add(entity.eid, attr, value) |
1228 session.update_rel_cache_add(entity.eid, attr, value) |
1228 rdef = session.rtype_eids_rdef(attr, entity.eid, value) |
1229 rdef = session.rtype_eids_rdef(attr, entity.eid, value) |
1229 if rdef.cardinality[1] in '1?' and activintegrity: |
1230 if rdef.cardinality[1] in '1?' and activintegrity: |
1230 with security_enabled(session, read=False): |
1231 with security_enabled(session, read=False): |
1231 session.execute('DELETE X %s Y WHERE Y eid %(y)s', |
1232 session.execute('DELETE X %s Y WHERE Y eid %%(y)s' % attr, |
1232 {'x': entity.eid, 'y': value}) |
1233 {'x': entity.eid, 'y': value}) |
1233 edited.set_defaults() |
1234 edited.set_defaults() |
1234 if session.is_hook_category_activated('integrity'): |
1235 if session.is_hook_category_activated('integrity'): |
1235 edited.check(creation=True) |
1236 edited.check(creation=True) |
1236 try: |
1237 try: |
1336 """delete a list of entities and all related entities from the repository""" |
1337 """delete a list of entities and all related entities from the repository""" |
1337 # mark eids as being deleted in session info and setup cache update |
1338 # mark eids as being deleted in session info and setup cache update |
1338 # operation (register pending eids before actual deletion to avoid |
1339 # operation (register pending eids before actual deletion to avoid |
1339 # multiple call to glob_delete_entities) |
1340 # multiple call to glob_delete_entities) |
1340 op = hook.CleanupDeletedEidsCacheOp.get_instance(session) |
1341 op = hook.CleanupDeletedEidsCacheOp.get_instance(session) |
|
1342 if not isinstance(eids, (set, frozenset)): |
|
1343 warn('[3.13] eids should be given as a set', DeprecationWarning, |
|
1344 stacklevel=2) |
|
1345 eids = frozenset(eids) |
1341 eids = eids - op._container |
1346 eids = eids - op._container |
1342 op._container |= eids |
1347 op._container |= eids |
1343 data_by_etype_source = {} # values are ([list of eids], |
1348 data_by_etype_source = {} # values are ([list of eids], |
1344 # [list of extid], |
1349 # [list of extid], |
1345 # [list of entities]) |
1350 # [list of entities]) |