Permalink
Browse files

import MultiValueDictKeyError properly

  • Loading branch information...
fhahn committed Aug 13, 2011
1 parent 695808e commit 786fb6e5dc30a34e45bab7a28158b9e41b7fa2ea
Showing with 6 additions and 6 deletions.
  1. +6 −6 tagging_autocomplete/views.py
@@ -2,15 +2,15 @@
from tagging.models import Tag
from django.http import HttpResponse
from django.utils import simplejson
+from django.utils.datastructures import MultiValueDictKeyError
def list_tags(request):
- try:
- tags = Tag.objects.filter(name__istartswith=request.GET['term']).values_list('name', flat=True)
- except MultiValueDictKeyError:
- tags = []
-
- return JsonResponse([x.encode('utf-8') for x in tags])
+ try:
+ tags = Tag.objects.filter(name__istartswith=request.GET['term']).values_list('name', flat=True)
+ except MultiValueDictKeyError:
+ tags = []
+ return JsonResponse([x.encode('utf-8') for x in tags])
class JsonResponse(HttpResponse):

0 comments on commit 786fb6e

Please sign in to comment.