def delete(self, paths):
"""Delete L{Tag}s matching C{paths}.
L{TagValue}s and permissions associated with the deleted L{Tag}s are
removed by cascading deletes in the database schema.
@param paths: A sequence of L{Tag.path}s.
@return: A C{list} of C{(objectID, Tag.path)} 2-tuples representing the
L{Tag}s that were removed.
"""
if isgenerator(paths):
paths = list(paths)
result = getTags(paths=paths)
deletedTagPaths = list(result.values(Tag.objectID, Tag.path))
# Delete the fluiddb/tags/description tag values stored for removed
# tags. Associated TagValue's are removed by an ON DELETE CASCADE
# trigger.
self._factory.tagValues(self._user).delete(
[(objectID, path) for objectID, _ in deletedTagPaths
for path in [u'fluiddb/tags/description', u'fluiddb/tags/path']])
# Touch all the objects for the given tag paths.
objectIDs = list(getObjectIDs(paths))
touchObjects(objectIDs)
result.remove()
return deletedTagPaths
评论列表
文章目录