def delete(self, paths):
"""Delete L{Namespace}s matching C{paths}.
@param paths: A sequence of L{Namespace.path}s.
@raises NotEmptyError: Raised if the L{Namespace} is not empty.
@return: A C{list} of C{(objectID, Namespace.path)} 2-tuples
representing the deleted L{Namespace}s.
"""
if isgenerator(paths):
paths = list(paths)
if getChildNamespaces(paths).any() or getChildTags(paths).any():
raise NotEmptyError("Can't delete non-empty namespaces.")
result = getNamespaces(paths=paths)
deletedNamespaces = list(result.values(Namespace.objectID,
Namespace.path))
values = [(objectID, systemTag)
for objectID, _ in deletedNamespaces
for systemTag in (u'fluiddb/namespaces/description',
u'fluiddb/namespaces/path')]
if values:
self._factory.tagValues(self._user).delete(values)
result.remove()
return deletedNamespaces
评论列表
文章目录