Add a 'type' string to all etiquette jsonify outputs.
This commit is contained in:
		
							parent
							
								
									dd3d40de53
								
							
						
					
					
						commit
						5a16579fe3
					
				
					 1 changed files with 6 additions and 0 deletions
				
			
		|  | @ -5,6 +5,7 @@ dictionaries suitable for JSON serializing. | ||||||
| 
 | 
 | ||||||
| def album(a, minimal=False): | def album(a, minimal=False): | ||||||
|     j = { |     j = { | ||||||
|  |         'type': 'album', | ||||||
|         'id': a.id, |         'id': a.id, | ||||||
|         'description': a.description, |         'description': a.description, | ||||||
|         'title': a.title, |         'title': a.title, | ||||||
|  | @ -19,6 +20,7 @@ def album(a, minimal=False): | ||||||
| 
 | 
 | ||||||
| def bookmark(b): | def bookmark(b): | ||||||
|     j = { |     j = { | ||||||
|  |         'type': 'bookmark', | ||||||
|         'id': b.id, |         'id': b.id, | ||||||
|         'author': user_or_none(b.get_author()), |         'author': user_or_none(b.get_author()), | ||||||
|         'url': b.url, |         'url': b.url, | ||||||
|  | @ -28,6 +30,7 @@ def bookmark(b): | ||||||
| 
 | 
 | ||||||
| def exception(e): | def exception(e): | ||||||
|     j = { |     j = { | ||||||
|  |         'type': 'error', | ||||||
|         'error_type': e.error_type, |         'error_type': e.error_type, | ||||||
|         'error_message': e.error_message, |         'error_message': e.error_message, | ||||||
|     } |     } | ||||||
|  | @ -37,6 +40,7 @@ def photo(p, include_albums=True, include_tags=True): | ||||||
|     tags = p.get_tags() |     tags = p.get_tags() | ||||||
|     tags.sort(key=lambda x: x.name) |     tags.sort(key=lambda x: x.name) | ||||||
|     j = { |     j = { | ||||||
|  |         'type': 'photo', | ||||||
|         'id': p.id, |         'id': p.id, | ||||||
|         'author': user_or_none(p.get_author()), |         'author': user_or_none(p.get_author()), | ||||||
|         'extension': p.extension, |         'extension': p.extension, | ||||||
|  | @ -64,6 +68,7 @@ def photo(p, include_albums=True, include_tags=True): | ||||||
| 
 | 
 | ||||||
| def tag(t, include_synonyms=False, minimal=False): | def tag(t, include_synonyms=False, minimal=False): | ||||||
|     j = { |     j = { | ||||||
|  |         'type': 'tag', | ||||||
|         'id': t.id, |         'id': t.id, | ||||||
|         'name': t.name, |         'name': t.name, | ||||||
|     } |     } | ||||||
|  | @ -78,6 +83,7 @@ def tag(t, include_synonyms=False, minimal=False): | ||||||
| 
 | 
 | ||||||
| def user(u): | def user(u): | ||||||
|     j = { |     j = { | ||||||
|  |         'type': 'user', | ||||||
|         'id': u.id, |         'id': u.id, | ||||||
|         'username': u.username, |         'username': u.username, | ||||||
|         'created': u.created, |         'created': u.created, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue