<commit_before>from django.shortcuts import render_to_response
from kannada.models import Movie
from kannada.forms import MovieForm
from django.template.context import RequestContext
import json
from django.http import HttpResponse

def search(request):
	movies = Movie.objects.all()
	movie_names = []
	for movie in movies:
		movie_names.append(str(movie.name))
	if request.method == 'POST':
		form = MovieForm(request.POST)
		print form.is_valid()
		if form.is_valid():
			print form.is_valid()
			movie_name = form.cleaned_data['movie_name']
			print movie_name
			movie_description = Movie.objects.get(name = movie_name)
			print movie_description.tagline
			form = MovieForm()
			print "inside post"
			return render_to_response('index.html',locals(),context_instance=RequestContext(request))
	else:
		movies = Movie.objects.all()
		movie_names = []
		for movie in movies:
			movie_names.append(str(movie.name))
			form = MovieForm(request.GET)
			if form.is_valid():
				movie_name = form.cleaned_data['movie_name']<commit_msg>adding try except block<commit_after>from django.shortcuts import render_to_response
from kannada.models import Movie
from kannada.forms import MovieForm
from django.template.context import RequestContext
import json
from django.http import HttpResponse

def search(request):
	try:
		movies = Movie.objects.all()
	except Movie.DoesNotExist as e:
		print e
	movie_names = []
	for movie in movies:
		movie_names.append(str(movie.name))
	if request.method == 'POST':
		form = MovieForm(request.POST)
		print form.is_valid()
		if form.is_valid():
			print form.is_valid()
			movie_name = form.cleaned_data['movie_name']
			print movie_name
			movie_description = Movie.objects.get(name = movie_name)
			print movie_description.tagline
			form = MovieForm()
			print "inside post"
			return render_to_response('index.html',locals(),context_instance=RequestContext(request))
	else:
		try:
			movies = Movie.objects.all()
		except Movie.DoesNotExist as e:
			print e
		movie_names = []
		for movie in movies:
			movie_names.append(str(movie.name))
			form = MovieForm(request.GET)
			if form.is_valid():
				movie_name = form.cleaned_data['movie_name']
{'fraction_non_alphanumeric': 0.10105649977032613, 'fraction_numerical': 0.0, 'mean_word_length': 4.808, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3692967', 'n_tokens_mistral': 781, 'n_tokens_neox': 683, 'n_words': 164}