def matching_courses(request): if len(request.GET['term']) == 0: raise http.Http404 matching_nodes = drupal.get_matching_courses(term=request.GET['term']) json = simplejson.dumps(matching_nodes) return http.HttpResponse(json, mimetype="application/json")
def matching_courses(request): if len(request.GET['term']) == 0: raise CommandException(_("Invalid request")) school = None if 'school' in request.GET: try: school = School.objects.get(slug=request.GET['school']) except School.DoesNotExist: pass matching_nodes = drupal.get_matching_courses(school=school, term=request.GET['term']) json = simplejson.dumps(matching_nodes) return HttpResponse(json, mimetype="application/x-javascript")