Skip to content
This repository was archived by the owner on Apr 21, 2020. It is now read-only.

Commit ad90fc0

Browse files
committed
Merged in tomds/djangobb/subscriptions (pull request #38)
Setting to override notification behaviour
2 parents 584a086 + e0a1d73 commit ad90fc0

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

djangobb_forum/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ def get(key, default):
2727
USER_ONLINE_TIMEOUT = get('DJANGOBB_USER_ONLINE_TIMEOUT', 15 * 60)
2828
EMAIL_DEBUG = get('DJANGOBB_FORUM_EMAIL_DEBUG', False)
2929
POST_USER_SEARCH = get('DJANGOBB_POST_USER_SEARCH', 1)
30+
NOTIFICATION_HANDLER = get('DJANGOBB_NOTIFICATION_HANDLER', 'djangobb_forum.subscription.email_topic_subscribers')
3031

3132
# GRAVATAR Extension
3233
GRAVATAR_SUPPORT = get('DJANGOBB_GRAVATAR_SUPPORT', True)

djangobb_forum/subscription.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def send_mail(subject, text, from_email, rec_list, html=None):
3030
Unsubscribe %(unsubscribe_url)s""")
3131

3232

33-
def notify_topic_subscribers(post):
33+
def email_topic_subscribers(post):
3434
topic = post.topic
3535
post_body_text = strip_tags(post.body_html)
3636
if post != topic.head:
@@ -46,3 +46,14 @@ def notify_topic_subscribers(post):
4646
}
4747
#html_content = html_version(post)
4848
send_mail(subject, text_content, settings.DEFAULT_FROM_EMAIL, [to_email])
49+
50+
def notify_topic_subscribers(post):
51+
path = forum_settings.NOTIFICATION_HANDLER.split('.')
52+
module = '.'.join(path[:-1])
53+
func = path[-1]
54+
55+
module = __import__(module, globals(), locals(), [func], -1)
56+
handler = getattr(module, func)
57+
58+
handler(post)
59+

0 commit comments

Comments
 (0)