Skip to content

Commit

Permalink
try / catch in case a ressource does not exist anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Glatthard committed Aug 6, 2015
1 parent aa92cc5 commit c10d6a2
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions ipynbsrv/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1004,15 +1004,19 @@ def get_related_object(self):
"""
Get the object related.
"""
if self.container is not None:
return self.container
if self.container_image is not None:
return self.container_image
if self.group is not None:
return self.group
if self.share is not None:
return self.share
return None
# try / catch in case a ressource does not exist anymore
try:
if self.container is not None:
return self.container
if self.container_image is not None:
return self.container_image
if self.group is not None:
return self.group
if self.share is not None:
return self.share
return None
except Exception:
return None

def get_related_object_url(self):
"""
Expand Down

0 comments on commit c10d6a2

Please sign in to comment.