diff options
author | Dusty Phillips <buchuki@gmail.com> | 2008-06-27 17:06:30 -0400 |
---|---|---|
committer | Dusty Phillips <buchuki@gmail.com> | 2008-06-27 17:18:08 -0400 |
commit | 34c744967ac869859778a46e41cbdeebeb150d85 (patch) | |
tree | ab7d3d73f6b2b67e8d0b766198868c295a6bd65f | |
parent | c1d28bce3353b3d76d59e22761cf21b710dd1bc4 (diff) |
better exception handling
-rw-r--r-- | todolists/views.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/todolists/views.py b/todolists/views.py index 2a7d1f09..82f2d94a 100644 --- a/todolists/views.py +++ b/todolists/views.py @@ -1,3 +1,5 @@ +import django.newforms as forms + from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import get_object_or_404 from django.contrib.auth.decorators import permission_required @@ -56,8 +58,8 @@ def add(request): try: todopkg.save() except IntegrityError, (num, desc): - if num == 1062: # duplicate entry aka dupe package on list - pass + if num != 1062: # duplicate entry aka dupe package on list + raise return HttpResponseRedirect('/todo/') return render_response(request, 'todolists/add.html') |