Hi,
> 1. I make a post.
> 2. person A makes a comment in the above post (i get notified).
> 3. person B makes a comment in the same post, this is where i wold like
> to have a notification to me (this is what is built in at the moment i
> think) and person A (i dont think this is implemented).
> 4. if more comments are added i would like to be notified as well as
> have notifying mails sent to the persons who already made comments in
> that post.
Oh, I'm sorry for my misunderstanding.
So, let's more customize!
To achieve your goal, it needs that 'to_addr' indicates email addresses
of persons who post comments.
How can we get such email addresses?
Well, coreblogcomment object has 'email' field which stores email
address of person who post comment. So we can get email address by
getEmail() method(getToolByName).
Then, how can we get coreblogcomment object which is referenced to an
entry? Luckily, good method, 'getComment()' is ready in advance(in
COREBlog2/content/coreblogentry.py, line 471). So we can get comments by
getComment() method.
Now let's get email addresses list.
--------------------------------------------------
# Get comments referenced to an entry
com_list = context.getComment()
# Ready address list
# Default address for notification is ready
addr_list = [context.getNotify_to()]
# Get emails from comments and append them to address list
# But omit duplicated address
for com in com_list:
if not addr_list.count(com.getEmail()):
addr_list.append(com.getEmail())
--------------------------------------------------
Here, addr_list includes email addresses you want.
So give them to 'to_addr'.
--------------------------------------------------
to_addr = ','.join(addr_list)
--------------------------------------------------
Putting together all customization and default code:
--------------------------------------------------
#Get email addresses
com_list = context.getComment()
addr_list = [context.getNotify_to()]
for com in com_list:
if not addr_list.count(com.getEmail()):
addr_list.append(com.getEmail())
#Send notify mail if need
if context.getSend_comment_notification():
try:
to_addr = ','.join(addr_list)
from_addr = context.getNotify_from()
...
--------------------------------------------------
This code may look ugly or have wrong expression because of my less
programming experience. So I will be happy to hear any comments.
Regards,
--
Yusuke NAKAI
mail: [EMAIL PROTECTED]
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
[email protected]
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to [EMAIL PROTECTED]