aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoar Wandborg <git@wandborg.com>2012-06-10 18:18:26 +0200
committerJoar Wandborg <git@wandborg.com>2012-06-10 18:18:26 +0200
commit00722c99084da94e48d84ea9e740bc1e2a49d9b1 (patch)
treeed9f26a9e4c9a1fbf739e015408a9e86a3ab49e1
parent879ff4bde6afaee8bf5bdc2a0e659d66e767d424 (diff)
downloadmediagoblin-00722c99084da94e48d84ea9e740bc1e2a49d9b1.tar.lz
mediagoblin-00722c99084da94e48d84ea9e740bc1e2a49d9b1.tar.xz
mediagoblin-00722c99084da94e48d84ea9e740bc1e2a49d9b1.zip
Fixed some comment notification code for compliance with SQL
* Pulled instance name in notification email from config
-rw-r--r--mediagoblin/user_pages/lib.py25
-rw-r--r--mediagoblin/user_pages/views.py2
2 files changed, 15 insertions, 12 deletions
diff --git a/mediagoblin/user_pages/lib.py b/mediagoblin/user_pages/lib.py
index 79f9a2b2..a4be14c2 100644
--- a/mediagoblin/user_pages/lib.py
+++ b/mediagoblin/user_pages/lib.py
@@ -19,6 +19,7 @@ from mediagoblin.tools.template import render_template
from mediagoblin.tools.translate import pass_to_ugettext as _
from mediagoblin import mg_globals
+
def send_comment_email(user, comment, media, request):
"""
Sends comment email to user when a comment is made on their media.
@@ -32,23 +33,25 @@ def send_comment_email(user, comment, media, request):
comment_url = request.urlgen(
'mediagoblin.user_pages.media_home.view_comment',
- comment = comment._id,
- user = media.get_uploader.username,
- media = media.slug_or_id,
- qualified = True) + '#comment'
+ comment=comment._id,
+ user=media.get_uploader.username,
+ media=media.slug_or_id,
+ qualified=True) + '#comment'
- comment_author = comment.get_author['username']
+ comment_author = comment.get_author.username
rendered_email = render_template(
request, 'mediagoblin/user_pages/comment_email.txt',
- {'username':user.username,
- 'comment_author':comment_author,
- 'comment_content':comment.content,
- 'comment_url':comment_url})
+ {'username': user.username,
+ 'comment_author': comment_author,
+ 'comment_content': comment.content,
+ 'comment_url': comment_url})
send_email(
mg_globals.app_config['email_sender_address'],
[user.email],
- 'GNU MediaGoblin - {comment_author} '.format(
- comment_author=comment_author) + _('commented on your post'),
+ '{instance_title} - {comment_author} '.format(
+ comment_author=comment_author,
+ instance_title=mg_globals.app_config['html_title']) \
+ + _('commented on your post'),
rendered_email)
diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
index 4c5e7e9a..dad68ba5 100644
--- a/mediagoblin/user_pages/views.py
+++ b/mediagoblin/user_pages/views.py
@@ -162,7 +162,7 @@ def media_post_comment(request, media):
media_uploader = media.get_uploader
#don't send email if you comment on your own post
if (comment.author != media_uploader and
- media_uploader['wants_comment_notification']):
+ media_uploader.wants_comment_notification):
send_comment_email(media_uploader, comment, media, request)
return exc.HTTPFound(