Skip to content

Commit

Permalink
refs #911. Handles null token name.
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Littman committed May 25, 2018
1 parent e36a8a8 commit 637f45b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions sfm/ui/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ def test_post(self):
test2
@test3
null
"""})
self.assertEqual(3, Seed.objects.filter(collection=self.collection).count())
self.assertTrue(Seed.objects.filter(collection=self.collection, token='test3').exists())
Expand Down
3 changes: 2 additions & 1 deletion sfm/ui/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,8 @@ def post(self, request, *args, **kwargs):
cleaned_data = [clean_token(t) for t in tokens]

for token in cleaned_data:
if token:
# Can't save a token called "null". It causes problems.
if token and token.lower() != "null":
param = {'uid': token} if seeds_type == 'uid' else {'token__iexact': token}
if not Seed.objects.filter(collection=collection, **param).exists():
log.debug("Creating seed %s for collection %s", token, collection.pk)
Expand Down

0 comments on commit 637f45b

Please sign in to comment.