From 85f24dd1f5b493f0071bf973e9c2ad46fb8f3f83 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Mon, 14 Sep 2020 05:37:13 -0700 Subject: [PATCH] Let Photo.remove_tag only remove exact tag, not children. I wrote this because I felt it would be a useful shorthand, as a way of nuking all tags of a subtree off a photo, but it's too easy to cause collateral damage when composing remove_tag with other functions. So, when you remove tags from a photo, you'll have to be more specific. --- etiquette/objects.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/etiquette/objects.py b/etiquette/objects.py index d434af5..0ef0436 100644 --- a/etiquette/objects.py +++ b/etiquette/objects.py @@ -1025,11 +1025,8 @@ class Photo(ObjectBase): tag = self.photodb.get_tag(name=tag) self.photodb.log.debug('Removing %s from %s', tag, self) - tags = list(tag.walk_children()) - - for tag in tags: - pairs = {'photoid': self.id, 'tagid': tag.id} - self.photodb.sql_delete(table='photo_tag_rel', pairs=pairs) + pairs = {'photoid': self.id, 'tagid': tag.id} + self.photodb.sql_delete(table='photo_tag_rel', pairs=pairs) data = { 'id': self.id,