Don't call p.get_tags until needed, and don't sort them.
This commit is contained in:
		
							parent
							
								
									f56da72881
								
							
						
					
					
						commit
						fa57386908
					
				
					 1 changed files with 1 additions and 3 deletions
				
			
		|  | @ -37,8 +37,6 @@ def exception(e): | ||||||
|     return j |     return j | ||||||
| 
 | 
 | ||||||
| def photo(p, include_albums=True, include_tags=True): | def photo(p, include_albums=True, include_tags=True): | ||||||
|     tags = p.get_tags() |  | ||||||
|     tags = sorted(tags, key=lambda x: x.name) |  | ||||||
|     j = { |     j = { | ||||||
|         'type': 'photo', |         'type': 'photo', | ||||||
|         'id': p.id, |         'id': p.id, | ||||||
|  | @ -62,7 +60,7 @@ def photo(p, include_albums=True, include_tags=True): | ||||||
|         j['albums'] = [album(a, minimal=True) for a in p.get_containing_albums()] |         j['albums'] = [album(a, minimal=True) for a in p.get_containing_albums()] | ||||||
| 
 | 
 | ||||||
|     if include_tags: |     if include_tags: | ||||||
|         j['tags'] = [tag(t, minimal=True) for t in tags] |         j['tags'] = [tag(t, minimal=True) for t in p.get_tags()] | ||||||
| 
 | 
 | ||||||
|     return j |     return j | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue