Commit beede4f1 authored by carlosribas's avatar carlosribas
Browse files

Avoid IndexError

parent 4937eedc
......@@ -107,7 +107,10 @@ class Database(CachingMixin, models.Model):
def __get_database_attribute(self, db_name, attribute):
"""An accessor method for retrieving attributes from a list."""
return [x[attribute] for x in rnacentral_expert_dbs if x['name'].lower() == db_name.lower()].pop()
try:
return [x[attribute] for x in rnacentral_expert_dbs if x['name'].lower() == db_name.lower()].pop()
except IndexError:
return None
def get_absolute_url(self):
"""Get a URL for a Database object. Used for generating sitemaps."""
......
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