Rename comprehension variable to not look like a conflict.
The existing code worked fine, but it was odd to see that `tag` was both the loop variable as well as the key into the children. So let's change it.
This commit is contained in:
		
							parent
							
								
									a86c27ceb4
								
							
						
					
					
						commit
						c99e783d04
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		|  | @ -153,7 +153,7 @@ def mmf_photo_ids(photodb, tag_musts, tag_mays, tag_forbids, frozen_children): | ||||||
| 
 | 
 | ||||||
|     if tag_mays: |     if tag_mays: | ||||||
|         for tag in tag_mays: |         for tag in tag_mays: | ||||||
|             choices = helpers.sql_listify(tag.id for tag in frozen_children[tag]) |             choices = helpers.sql_listify(t.id for t in frozen_children[tag]) | ||||||
|             query = 'SELECT photoid FROM photo_tag_rel WHERE tagid in %s' % choices |             query = 'SELECT photoid FROM photo_tag_rel WHERE tagid in %s' % choices | ||||||
|             cur.execute(query) |             cur.execute(query) | ||||||
|             results.update(fetch[0] for fetch in cur.fetchall()) |             results.update(fetch[0] for fetch in cur.fetchall()) | ||||||
|  | @ -161,7 +161,7 @@ def mmf_photo_ids(photodb, tag_musts, tag_mays, tag_forbids, frozen_children): | ||||||
| 
 | 
 | ||||||
|     if tag_musts: |     if tag_musts: | ||||||
|         for tag in tag_musts: |         for tag in tag_musts: | ||||||
|             choices = helpers.sql_listify(tag.id for tag in frozen_children[tag]) |             choices = helpers.sql_listify(t.id for t in frozen_children[tag]) | ||||||
|             query = 'SELECT photoid FROM photo_tag_rel WHERE tagid in %s' % choices |             query = 'SELECT photoid FROM photo_tag_rel WHERE tagid in %s' % choices | ||||||
|             cur.execute(query) |             cur.execute(query) | ||||||
|             photo_ids = (fetch[0] for fetch in cur.fetchall()) |             photo_ids = (fetch[0] for fetch in cur.fetchall()) | ||||||
|  | @ -178,7 +178,7 @@ def mmf_photo_ids(photodb, tag_musts, tag_mays, tag_forbids, frozen_children): | ||||||
|         if not results: |         if not results: | ||||||
|             operator = 'NOT IN' |             operator = 'NOT IN' | ||||||
|         for tag in tag_forbids: |         for tag in tag_forbids: | ||||||
|             choices = helpers.sql_listify(tag.id for tag in frozen_children[tag]) |             choices = helpers.sql_listify(t.id for t in frozen_children[tag]) | ||||||
|             query = 'SELECT photoid FROM photo_tag_rel WHERE tagid in %s' % choices |             query = 'SELECT photoid FROM photo_tag_rel WHERE tagid in %s' % choices | ||||||
|             cur.execute(query) |             cur.execute(query) | ||||||
|             photo_ids = (fetch[0] for fetch in cur.fetchall()) |             photo_ids = (fetch[0] for fetch in cur.fetchall()) | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue