Permalink
Browse files

Handle the missing authinfo case

  • Loading branch information...
1 parent 6948e64 commit 6efa393dcb4bfa562d548941d3693f0c5aa1b2de @alex alex committed Aug 20, 2010
Showing with 9 additions and 4 deletions.
  1. +1 −1 dialogos/models.py
  2. +6 −0 dialogos/tests.py
  3. +2 −3 dialogos/views.py
View
@@ -9,7 +9,7 @@
class Comment(models.Model):
author = models.ForeignKey(User, null=True, related_name="comments")
- name = models.CharField(max_length=100, blank=True)
+ name = models.CharField(max_length=100)
email = models.CharField(max_length=255, blank=True)
website = models.CharField(max_length=255, blank=True)
View
@@ -39,6 +39,12 @@ def test_post_comment(self):
self.assertEqual(c.author, None)
self.assertEqual(c.name, "Frodo Baggins")
+ response = self.post_comment(g, data={
+ "comment": "Where is everyone?"
+ })
+ self.assertEqual(Comment.objects.count(), 1)
+
+
with self.login("gimli", "gloin"):
response = self.post_comment(g, data={
"comment": "I thought you were watching the hobbits?"
View
@@ -15,7 +15,6 @@ def post_comment(request, content_type_id, object_id):
else:
form_class = UnauthenticatedCommentForm
form = form_class(request.POST, request=request, obj=obj)
- if not form.is_valid():
- raise NotImplementedError
- form.save()
+ if form.is_valid():
+ form.save()
return redirect(obj)

0 comments on commit 6efa393

Please sign in to comment.