Skip to content

Commit 6bec739

Browse files
committed
smtp fix tag referencing
1 parent 23a441d commit 6bec739

2 files changed

Lines changed: 27 additions & 21 deletions

File tree

smtp_handler/main.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import logging, time, base64
1+
import logging, time, base64, sys, traceback
22
from lamson.routing import route, stateless
33
from config.settings import relay
44
from http_handler.settings import WEBSITE
@@ -484,7 +484,10 @@ def handle_post_murmur(message, group, host, verified):
484484

485485
except Exception, e:
486486
logger.debug(e)
487-
send_error_email(group.name, e, None, ADMIN_EMAILS)
487+
exc_type, exc_obj, exc_tb = sys.exc_info()
488+
err_msg = "%s %s %s" % (exc_type, exc_tb.tb_lineno, str(e))
489+
490+
send_error_email(group.name, err_msg, None, ADMIN_EMAILS)
488491

489492
# try to deliver mail even without footers
490493
mail.Html = msg_text['html']
@@ -493,7 +496,10 @@ def handle_post_murmur(message, group, host, verified):
493496

494497
except Exception, e:
495498
logger.debug(e)
496-
send_error_email(group.name, e, None, ADMIN_EMAILS)
499+
exc_type, exc_obj, exc_tb = sys.exc_info()
500+
err_msg = "%s %s %s" % (exc_type, exc_tb.tb_lineno, str(e))
501+
502+
send_error_email(group.name, err_msg, None, ADMIN_EMAILS)
497503
return
498504

499505
def handle_post_squadbox(message, group, host, verified):

smtp_handler/utils.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,9 @@ def _insert_plain_tag_line(group, tags, membergroup, tag_following, tag_muting):
344344
if membergroup.no_emails or not membergroup.always_follow_thread:
345345
follow_tags = []
346346
for f in tag_following:
347-
follow_tags.append(f.tag.name)
348-
unfollow_tag_email = 'mailto:%s' % (group.name + '+' + f.tag.name + UNFOLLOW_TAG_SUFFIX + '@' + HOST)
349-
tag_str += 'Unfollow %s<%s> | ' % (f.tag.name, unfollow_tag_email)
347+
follow_tags.append(f.name)
348+
unfollow_tag_email = 'mailto:%s' % (group.name + '+' + f.name + UNFOLLOW_TAG_SUFFIX + '@' + HOST)
349+
tag_str += 'Unfollow %s<%s> | ' % (f.name, unfollow_tag_email)
350350

351351
for tag in tags:
352352
if tag.name not in follow_tags:
@@ -355,9 +355,9 @@ def _insert_plain_tag_line(group, tags, membergroup, tag_following, tag_muting):
355355
else:
356356
mute_tags = []
357357
for f in tag_muting:
358-
mute_tags.append(f.tag.name)
359-
unmute_tag_email = 'mailto:%s' % (group.name + '+' + f.tag.name + UNMUTE_TAG_SUFFIX + '@' + HOST)
360-
tag_str += 'Unmute %s<%s> | ' % (f.tag.name, unmute_tag_email)
358+
mute_tags.append(f.name)
359+
unmute_tag_email = 'mailto:%s' % (group.name + '+' + f.name + UNMUTE_TAG_SUFFIX + '@' + HOST)
360+
tag_str += 'Unmute %s<%s> | ' % (f.name, unmute_tag_email)
361361

362362
for tag in tags:
363363
if tag.name not in mute_tags:
@@ -374,17 +374,17 @@ def _insert_tag_line(group, tags, membergroup, tag_following, tag_muting):
374374
if membergroup.no_emails or not membergroup.always_follow_thread:
375375
follow_tags = []
376376
for f in tag_following:
377-
follow_tags.append(f.tag.name)
378-
tag_str += '<a href="%s%s&group=%s">Unfollow %s</a> | ' % (UNFOLLOW_TAG_ADDR, f.tag.name, group.name, f.tag.name)
377+
follow_tags.append(f.name)
378+
tag_str += '<a href="%s%s&group=%s">Unfollow %s</a> | ' % (UNFOLLOW_TAG_ADDR, f.name, group.name, f.name)
379379

380380
for tag in tags:
381381
if tag.name not in follow_tags:
382382
tag_str += ' <a href="%s%s&group=%s">Follow %s</a> |' % (FOLLOW_TAG_ADDR, tag.name, group.name, tag.name)
383383
else:
384384
mute_tags = []
385385
for f in tag_muting:
386-
mute_tags.append(f.tag.name)
387-
tag_str += '<a href="%s%s&group=%s">Unmute %s</a> | ' % (UNMUTE_TAG_ADDR, f.tag.name, group.name, f.tag.name)
386+
mute_tags.append(f.name)
387+
tag_str += '<a href="%s%s&group=%s">Unmute %s</a> | ' % (UNMUTE_TAG_ADDR, f.name, group.name, f.name)
388388

389389
for tag in tags:
390390
if tag.name not in mute_tags:
@@ -478,12 +478,12 @@ def html_ps(group, thread, post_id, membergroup, following, muting, tag_followin
478478
content += 'You\'re currently following this thread. <a href="%s">Un-Follow thread</a>.<BR>' % (unfollow_addr)
479479
else:
480480
if tag_following.count() > 0:
481-
tag_names = [f.tag.name for f in tag_following]
481+
tag_names = [f.name for f in tag_following]
482482
if len(tag_names) > 1:
483483
n_str = ', '.join(tag_names)
484-
content += 'You\'re currently following the tags %s. <BR>' % (n_str)
484+
content += 'You\'re currently following the tags: %s. <BR>' % (n_str)
485485
else:
486-
content += 'You\'re currently following the tag %s. <BR>' % (tag_names[0])
486+
content += 'You\'re currently following the tag: %s. <BR>' % (tag_names[0])
487487
else:
488488
content += 'You currently aren\'t receiving any replies to this thread. <a href="%s">Follow thread</a>.<BR>' % (follow_addr)
489489
else:
@@ -493,12 +493,12 @@ def html_ps(group, thread, post_id, membergroup, following, muting, tag_followin
493493
content += 'You\'re currently muting this thread. <a href="%s">Un-Mute thread</a>.<BR>' % (unmute_addr)
494494
else:
495495
if tag_muting.count() > 0:
496-
tag_names = [f.tag.name for f in tag_muting]
496+
tag_names = [f.name for f in tag_muting]
497497
if len(tag_names) > 1:
498498
n_str = ', '.join(tag_names)
499-
content += 'You\'re currently muting the tags %s. <BR>' % (n_str)
499+
content += 'You\'re currently muting the tags: %s. <BR>' % (n_str)
500500
else:
501-
content += 'You\'re currently muting the tag %s. <BR>' % (tag_names[0])
501+
content += 'You\'re currently muting the tag: %s. <BR>' % (tag_names[0])
502502
else:
503503
content += 'You\'re currently receiving emails to this thread. <a href="%s">Mute thread</a>.<BR>' % (mute_addr)
504504

@@ -543,7 +543,7 @@ def plain_ps(group, thread, post_id, membergroup, following, muting, tag_followi
543543
content += 'You\'re currently following this thread. Un-Follow thread<%s>.\n' % (unfollow_addr)
544544
else:
545545
if tag_following.count() > 0:
546-
tag_names = [m.tag.name for m in tag_muting]
546+
tag_names = [m.name for m in tag_muting]
547547
if len(tag_names) > 1:
548548
n_str = ', '.join(tag_names)
549549
content += 'You\'re currently following the tags %s. \n' % (n_str)
@@ -559,7 +559,7 @@ def plain_ps(group, thread, post_id, membergroup, following, muting, tag_followi
559559
content += 'You\'re currently muting this thread. Un-Mute thread<%s>.\n' % (unmute_addr)
560560
else:
561561
if tag_muting.count() > 0:
562-
tag_names = [m.tag.name for m in tag_muting]
562+
tag_names = [m.name for m in tag_muting]
563563
if len(tag_names) > 1:
564564
n_str = ', '.join(tag_names)
565565
content += 'You\'re currently muting the tags %s. \n' % (n_str)

0 commit comments

Comments
 (0)