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.
This commit is contained in:
		
							parent
							
								
									2dc1603d5e
								
							
						
					
					
						commit
						85f24dd1f5
					
				
					 1 changed files with 2 additions and 5 deletions
				
			
		|  | @ -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, | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue