Permalink
Browse files

test fix

  • Loading branch information...
1 parent 807261b commit 2e343b2dabf126a1ec2e7cf72a1cd35c7f39947c @camd camd committed Apr 8, 2013
Showing with 5 additions and 1 deletion.
  1. +5 −1 moztrap/model/library/api.py
View
6 moztrap/model/library/api.py
@@ -361,7 +361,11 @@ class Meta:
def dehydrate(self, bundle):
"""Add some convenience fields to the return JSON."""
- bundle.data["name"] = unicode(bundle.obj.versions.all()[0].name)
+ versions = bundle.obj.versions.all()
+ if versions:
+ bundle.data["name"] = unicode(bundle.obj.versions.all()[0].name)
+ else:
+ bundle.data["name"] = "No version Exists for this case."
bundle.data["order"] = bundle.obj.order
return bundle

0 comments on commit 2e343b2

Please sign in to comment.