diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-05-08 17:21:07 -0300 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2014-05-08 17:21:07 -0300 |
commit | c7985a3d35a0f1099aa4c12c84a71c038bb2d1d0 (patch) | |
tree | f54325ce00ecf0811dccf9c2a2daff8a9a883824 | |
parent | c86905cb084a77c8ace0d5f930e3d5e828c71f44 (diff) | |
download | askbot-c7985a3d35a0f1099aa4c12c84a71c038bb2d1d0.tar.gz askbot-c7985a3d35a0f1099aa4c12c84a71c038bb2d1d0.tar.bz2 askbot-c7985a3d35a0f1099aa4c12c84a71c038bb2d1d0.zip |
fixed email alert sender when there are no tags in the subject line
-rw-r--r-- | askbot/management/commands/send_email_alerts.py | 25 | ||||
-rw-r--r-- | askbot/models/question.py | 2 |
2 files changed, 19 insertions, 8 deletions
diff --git a/askbot/management/commands/send_email_alerts.py b/askbot/management/commands/send_email_alerts.py index a9162079..dbaff93f 100644 --- a/askbot/management/commands/send_email_alerts.py +++ b/askbot/management/commands/send_email_alerts.py @@ -432,14 +432,23 @@ class Command(NoArgsCommand): question_count = len(q_list.keys()) - subject_line = ungettext( - '%(question_count)d update about %(topics)s', - '%(question_count)d updates about %(topics)s', - question_count - ) % { - 'question_count': question_count, - 'topics': tag_summary - } + if tag_summary: + subject_line = ungettext( + '%(question_count)d update about %(topics)s', + '%(question_count)d updates about %(topics)s', + question_count + ) % { + 'question_count': question_count, + 'topics': tag_summary + } + else: + subject_line = ungettext( + '%(question_count)d update', + '%(question_count)d updates', + question_count + ) % { + 'question_count': question_count, + } items_added = 0 items_unreported = 0 diff --git a/askbot/models/question.py b/askbot/models/question.py index 737a0876..97ce8999 100644 --- a/askbot/models/question.py +++ b/askbot/models/question.py @@ -122,6 +122,8 @@ class ThreadManager(BaseQuerySetManager): tag_list.sort(key=lambda t: tag_counts[t], reverse=True) #note that double quote placement is important here + if len(tag_list) == 0: + return '' if len(tag_list) == 1: last_topic = '"' elif len(tag_list) <= 5: |