comparison gpp/forums/views/spam.py @ 316:767cedc7d12a

Fixing #144; integrate with new Django logging support. Also added unit tests for Donations app.
author Brian Neal <bgneal@gmail.com>
date Sun, 30 Jan 2011 20:02:32 +0000
parents a46788862737
children d1b11096595b
comparison
equal deleted inserted replaced
315:36373d995611 316:767cedc7d12a
67 poster.is_superuser) 67 poster.is_superuser)
68 68
69 if request.method == "POST" and can_moderate and can_deactivate: 69 if request.method == "POST" and can_moderate and can_deactivate:
70 deactivate_spammer(poster) 70 deactivate_spammer(poster)
71 71
72 email_admins(SPAMMER_NAILED_SUBJECT % poster.username, 72 email_admins(SPAMMER_NAILED_SUBJECT % poster.username,
73 SPAMMER_NAILED_MSG_BODY % ( 73 SPAMMER_NAILED_MSG_BODY % (
74 request.user.username, poster.username)) 74 request.user.username, poster.username))
75 75
76 logging.info(textwrap.dedent("""\ 76 logging.info(textwrap.dedent("""\
77 SPAMMER DEACTIVATED: %s nailed %s for spam. 77 SPAMMER DEACTIVATED: %s nailed %s for spam.
78 IP: %s 78 IP: %s
79 Message: 79 Message:
80 %s 80 %s
81 """ % (request.user.username, poster.username, post.user_ip, 81 """),
82 post.body))) 82 request.user.username, poster.username, post.user_ip, post.body)
83 83
84 return HttpResponseRedirect(reverse('forums-spammer_nailed', args=[ 84 return HttpResponseRedirect(reverse('forums-spammer_nailed', args=[
85 poster.id])) 85 poster.id]))
86 86
87 return render_to_response('forums/spammer.html', { 87 return render_to_response('forums/spammer.html', {
124 can_promote = poster_profile.status == bio.models.STA_STRANGER 124 can_promote = poster_profile.status == bio.models.STA_STRANGER
125 125
126 if request.method == "POST" and can_moderate and can_promote: 126 if request.method == "POST" and can_moderate and can_promote:
127 promote_stranger(poster) 127 promote_stranger(poster)
128 128
129 logging.info("STRANGER PROMOTED: %s promoted %s." % ( 129 logging.info("STRANGER PROMOTED: %s promoted %s.",
130 request.user.username, poster.username)) 130 request.user.username, poster.username)
131 131
132 return HttpResponseRedirect(post.get_absolute_url()) 132 return HttpResponseRedirect(post.get_absolute_url())
133 133
134 return render_to_response('forums/stranger.html', { 134 return render_to_response('forums/stranger.html', {
135 'can_moderate': can_moderate, 135 'can_moderate': can_moderate,