def allnews(request): if request.method == 'POST': searchform = SearchForm(request.POST) if searchform.is_valid() is False: return HttpResponse("400 - Bad request", status=400) data = searchform.cleaned_data builder = SPARQLQueryBuilder() try: query = builder.create_query_from_form(data) except SPARQLQueryBuilderError, e: return render_to_response('debian/error.html', {'reason': e}) processor = SPARQLQueryProcessor() try: processor.execute_sanitized_query(query) except SPARQLQueryProcessorError, e: return render_to_response('debian/error.html', {'reason': e})
def results(request): if request.method == 'POST': searchform = SearchForm(request.POST) if searchform.is_valid() is False: sparqlform = SPARQLForm() dict = {'search': searchform, 'sparql': sparqlform} return render_to_response('debian/search.html', dict) data = searchform.cleaned_data builder = SPARQLQueryBuilder() try: query = builder.create_query_from_form(data) except SPARQLQueryBuilderError, e: return render_to_response('debian/error.html', {'reason': e}) processor = SPARQLQueryProcessor() try: processor.execute_sanitized_query(query) except SPARQLQueryProcessorError, e: return render_to_response('debian/error.html', {'reason': e})