Commit 6009d537 authored by carlosribas's avatar carlosribas
Browse files

Avoid error when there is no count

parent d43861b5
......@@ -13,7 +13,12 @@ class RnaFastaRenderer(renderers.BaseRenderer):
RnaFastaSerializer can return either a single entry or a list of entries.
if 'results' in data: # list of entries
text = '# %i total entries, next page: %s, previous page: %s\n' % (data['count'], data['next'], data['previous'])
text = '# %i total entries, next page: %s, previous page: %s\n' % (
data['count'], data['next'], data['previous']
except KeyError:
text = '# next page: %s, previous page: %s\n' % (data['next'], data['previous'])
for entry in data['results']:
text += entry['fasta']
return text
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment