Permalink
Browse files

Added a request_finished signal to an email receiver as a test for so…

…me work stuff.
  • Loading branch information...
1 parent 6dd2bf9 commit df6bee4340a2f46650e4616afd71884a2494e1fe @mattdeboard committed May 19, 2011
Showing with 8 additions and 7 deletions.
  1. +5 −7 yuk/email.py
  2. +3 −0 yuk/views.py
View
@@ -1,11 +1,9 @@
-from django.core.mail import send_mail, EmailMessage
+from django.core.mail import EmailMessage
from yukproj.settings import DEFAULT_FROM_EMAIL
-def email_send(request, *args, **kwargs):
+def item_saved(sender, **kwargs):
+ subject="foo"
+ body="bar"
email = EmailMessage(subject, body, DEFAULT_FROM_EMAIL,
- [request.user.email])
- if kwargs['msg_type'] == 'pwd_reset':
- subject = 'Password reset confirmation - Yukmarks.com'
- body =
-
+ ['matt.deboard@gmail.com'])
email.send()
View
@@ -10,13 +10,15 @@
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
+from django.core.signals import request_finished
from django.shortcuts import render_to_response, redirect
from django.template import RequestContext
from django.http import HttpResponseRedirect, HttpResponse
from django.contrib import messages
from haystack.query import SearchQuerySet
from yuk.models import Item
from yuk.forms import *
+from yuk import email
from yuk.rss_module import rssdownload
from yuk.scripts import import_text_file
@@ -108,6 +110,7 @@ def new_url(request):
g.save()
form.save_m2m()
messages.success(request, "Your bookmark was saved!")
+ request_finished.connect(email.item_saved)
return redirect('yuk.views.profile', uname=request.user)
return render_to_response('new_item.html', {'form':form},

0 comments on commit df6bee4

Please sign in to comment.