From 7828b2937ca6da19ee5126158584ffdc394d030a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuz=20Yar=C4=B1mtepe?= Date: Fri, 9 Jul 2010 07:15:46 +0000 Subject: [PATCH] Syntax fixes with my branch --- DJAGEN/trunk/djagen/collector/views.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/DJAGEN/trunk/djagen/collector/views.py b/DJAGEN/trunk/djagen/collector/views.py index 22f637f..f7652d5 100755 --- a/DJAGEN/trunk/djagen/collector/views.py +++ b/DJAGEN/trunk/djagen/collector/views.py @@ -7,6 +7,7 @@ from djagen.collector.models import * from djagen.collector.forms import ContactForm, QueryForm from djagen.collector.wrappers import render_response from django.conf import settings +from django.utils.datastructures import MultiValueDictKeyError import magic import os import datetime, time @@ -38,7 +39,7 @@ def main(request): last_entry_date -= day last_date_li.append(last_entry_date) - return render_to_response('main/main.html' ,{ + return render_response(request, 'main/main.html' ,{ 'entries_list':entries_list, 'truncate_words':truncate_words, 'items_per_page':repr(items_per_page), @@ -55,13 +56,12 @@ def member_subscribe(request): human = True try: check = handle_uploaded_file(request.FILES['hackergotchi']) - except: + except MultiValueDictKeyError: check = (False,False) #save the author information - f = request.FILES['hackergotchi'] - if check[0]: + f = request.FILES['hackergotchi'] #change the name of the file with the unique name created f.name = check[1] @@ -69,13 +69,12 @@ def member_subscribe(request): author = Authors(author_name=request.POST['name'], author_surname=request.POST['surname'], author_email=request.POST['email'], channel_url=request.POST['feed'], author_face=f.name, is_approved=0, current_status=5) else: author = Authors(author_name=request.POST['name'], author_surname=request.POST['surname'], author_email=request.POST['email'], channel_url=request.POST['feed'], is_approved=0, current_status=5) - try: - author.save() + + author.save() - #save the history with explanation - author.history_set.create(action_type=5, action_date=datetime.datetime.now(), action_explanation=request.POST['message']) - except: - pass + #save the history with explanation + author.history_set.create(action_type=5, action_date=datetime.datetime.now(), action_explanation=request.POST['message']) + #send mail part #fill it here return render_response(request, 'main/subscribe.html/',{'submit': 'done', 'BASE_URL': BASE_URL})