List Info

Thread: Comment reply handling




Comment reply handling
user name
2006-12-16 20:43:05
Hi,

I have been wondering if CoreBlog2 only sends the notification mail to the email set in the blog settings or if it mails a notice to the prior commentators for that post as well, my guess would be the first option.

If so would it be possible to change the behavior to send a notice mail to the prior commentators as well?

--
With best regards / med vänlig hälsning

Niklas
Comment reply handling
user name
2006-12-17 05:07:18
Hi,

> If so would it be possible to change the behavior to
send a notice mail 
> to the prior commentators as well?

How about customizing
/plone/portal_skins/COREBlog2/cbaddComment?


Regards,

-- 
Yusuke NAKAI

mail: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-18 10:01:37
I guess thats a yes to my first question?

I would really like to do it, but my programming skills is limited at a very low level for now, but i guess i will have to add it as a feature request.

/Niklas

On 12/17/06, Yusuke NAKAI < nyusukenagosui.org">nyusukenagosui.org> wrote:
Hi,

> If so would it be possible to change the behavior to send a notice mail
> to the prior commentators as well?

How about customizing /plone/portal_skins/COREBlog2/cbaddComment?


Regards,

--
Yusuke NAKAI

mail: nyusukenagosui.org">nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com">COREblog-enpostaria.com
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com"> coreblog-en-leavepostaria.com



--
With best regards / med vänlig hälsning

Niklas
Comment reply handling
user name
2006-12-18 16:55:17
Hi,

> I would really like to do it,  
> but my programming skills is limited at a very low
level for now

Me too!
But you're lucky to get chance to learning python, aren't
you?


First of all, there is a typo in cbaddComment around line
40:

--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
     try:
         to_addr   = context.getNotify_to()
         from_addr = context.getNotify_to() <- here
--------------------------------------------------

This should be:
         from_addr = context.getNotify_from()
                                       ^^^^^^


Well, let's customize.
You can customize notification mail by assorting these
objects and 
setting them to 'to_addr' or 'from_addr'.

  - context.getNotify_to()
      -> e-mail address entered to 'Notify To' field on
'blog settings'

  - context.getNotity_from()
      -> e-mail address entered to 'Notify From' field on
'blog settings'

  - REQUEST.form['email']
      -> e-mail address entered by comment form


Now assuming in your blog settings:
  - Notify From: spamexample.com
  - Notify To: eggexample.com
  - checked 'Require email'


Let's see some cases.

1.To send notification mail
  from spamexample.com
  to eggexample.com,
  no customization is needed(default action).

2.To send notification mail
  from spamexample.com
  to person who post comment,
  customization in cbaddComment will be like this:
--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
     try:
         to_addr   = REQUEST.form['email']
         from_addr = context.getNotify_from()
--------------------------------------------------

3.To send notification mail
  from person who post comment
  to eggexample.com,
  customization in cbaddComment will be like this:
--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
     try:
         to_addr   = context.getNotify_to()
         from_addr = REQUEST.form['email']
--------------------------------------------------


Note: If 'Require email' is 'not' checked in your blog
setting, it seems 
to be better to do conditional branch where
'REQUEST.form['email']' appears.

For example, in case 3. on above,
--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
     try:
         to_addr = context.getNotify_to()
         if REQUEST.form['email'] == "":
             from_addr = 'someone_posting_commentexample.com'
         else:
             from_addr = REQUEST.form['email']
--------------------------------------------------


Unfortunately I'm not skilled at programming, so I'm not
confident these 
codes help you, and afraid if I misunderstood your
intention. I hope for 
someone's following up.

Regards,

-- 
Yusuke NAKAI

mail: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-18 20:33:10
Thanx for your efforts Mr, NAKAI,

If i understand what you are describing correctly, its not entirely what i wold like to do,

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.

/Niklas


On 12/18/06, Yusuke NAKAI < nyusukenagosui.org">nyusukenagosui.org> wrote:
Hi,

> I would really like to do it,
> but my programming skills is limited at a very low level for now

Me too!
But you're lucky to get chance to learning python, aren't you?


First of all, there is a typo in cbaddComment around line 40:

--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
&nbsp; &nbsp;  try:
 ; &nbsp; &nbsp; &nbsp;  to_addr&nbsp;  = context.getNotify_to()
 &nbsp; &nbsp; &nbsp;   from_addr = context.getNotify_to () <- here
--------------------------------------------------

This should be:
   ; &nbsp; &nbsp;  from_addr = context.getNotify_from()
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; ^^^^^^


Well, let's customize.
You can customize notification mail by assorting these objects and
setting them to 'to_addr' or 'from_addr'.

 &nbsp;- context.getNotify_to()
 &nbsp; &nbsp; &nbsp;-> e-mail address entered to 'Notify To' field on 'blog settings'

 &nbsp;- context.getNotity_from()
 &nbsp;   ; ->; e-mail address entered to 'Notify From' field on 'blog settings'

 &nbsp;- REQUEST.form['email']
 &nbsp; &nbsp; &nbsp;-> e-mail address entered by comment form


Now assuming in your blog settings:
 &nbsp;- Notify From: spamexample.com">spamexample.com
 &nbsp;- Notify To: eggexample.com">eggexample.com
 &nbsp;- checked 'Require email'


Let's see some cases.

1.To send notification mail
 ; from spamexample.com">spamexample.com
 &nbsp;to eggexample.com">eggexample.com,
 &nbsp;no customization is needed(default action).

2.To send notification mail
&nbsp; from spamexample.com">spamexample.com
 &nbsp;to person who post comment,
&nbsp; customization in cbaddComment will be like this:
--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
&nbsp; &nbsp;  try:
 ; &nbsp; &nbsp; &nbsp;  to_addr&nbsp;  = REQUEST.form['email']
 &nbsp; &nbsp; &nbsp; &nbsp; from_addr = context.getNotify_from()
--------------------------------------------------

3.To send notification mail
&nbsp; from person who post comment
&nbsp; to eggexample.com">eggexample.com,
 &nbsp;customization in cbaddComment will be like this:
--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
&nbsp; &nbsp;  try:
 ; &nbsp; &nbsp; &nbsp;  to_addr&nbsp;  = context.getNotify_to()
 &nbsp; &nbsp; &nbsp;   from_addr = REQUEST.form['email']
--------------------------------------------------


Note: If 'Require email' is 'not' checked in your blog setting, it seems
to be better to do conditional branch where 'REQUEST.form['email']' appears.

For example, in case 3. on above,
--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification ():
&nbsp; &nbsp;  try:
 ; &nbsp; &nbsp; &nbsp;  to_addr = context.getNotify_to()
 &nbsp; &nbsp; &nbsp;   if REQUEST.form['email'] == "&quot;:
 &nbsp;   ; &nbsp; &nbsp; &nbsp;  from_addr = ' someone_posting_commentexample.com">someone_posting_commentexample.com '
   ; &nbsp; &nbsp;  else:
&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; from_addr = REQUEST.form['email']
--------------------------------------------------


Unfortunately I'm not skilled at programming, so I'm not confident these
codes help you, and afraid if I misunderstood your intention. I hope for
someone's following up.

Regards,

--
Yusuke NAKAI

mail: nyusukenagosui.org">nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com">COREblog-enpostaria.com
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com">coreblog-en-leavepostaria.com



--
With best regards / med vänlig hälsning

Niklas
Comment reply handling
user name
2006-12-19 16:02:34
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: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-19 17:26:50
(Wed, Dec 20, 2006 at 01:02:34AM +0900) Yusuke NAKAI
wrote/schrieb/egrapse:
> to_addr   = ','.join(addr_list)

Instant security / privacy problem. 

Every recipient of the mail will learn all the email
addresses of all
the other recipients. Either use BCC or send each recipient
a separate
mail.

Regards,

Sascha

_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-19 20:40:37
Thanx again Mr. NAKAI and Mr. Welter,

Mr. NAKAI for saying you dont have a lot of experiance, you sure know your way around this code.

The code seems to be working ok,

I tried to find where to change to BCC but could not find the right reference, i agree with this beeing a problem, is it hard to change?.

This might be to ask for to much but i will still ask, is it a hard job to add a check box (notify me when furter comments are added to this post) in the comment form and have the  mails selected bu this check box?

/Niklas


On 12/19/06, Sascha Welter < welterbetabug.ch" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> welterbetabug.ch> wrote:
(Wed, Dec 20, 2006 at 01:02:34AM +0900) Yusuke NAKAI wrote/schrieb/egrapse:
> to_addr&nbsp;  = ',';.join(addr_list)

Instant security / privacy problem.

Every recipient of the mail will learn all the email addresses of all
the other recipients. Either use BCC or send each recipient a separate
mail.

Regards,

Sascha

_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> COREblog-enpostaria.com
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> coreblog-en-leavepostaria.com



--
With best regards / med vänlig hälsning

Niklas
Comment reply handling
user name
2006-12-20 15:22:16
Hi,

Sascha Welter wrote:
> (Wed, Dec 20, 2006 at 01:02:34AM +0900) Yusuke NAKAI
wrote/schrieb/egrapse:
>> to_addr   = ','.join(addr_list)
> 
> Instant security / privacy problem. 
> 
> Every recipient of the mail will learn all the email
addresses of all
> the other recipients. Either use BCC or send each
recipient a separate
> mail.

Thanks a lot!
I have a shame of feeling for my lack of basic security
sense...

Regards,

-- 
Yusuke NAKAI

mail: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-20 16:33:16
Hi,

> I tried to find where to change to BCC but could not
find the right 
> reference, i agree with this beeing a problem, is it
hard to change?.

Notification mail is send by Trainingool.send_mail() method:

--------------------------------------------------
         ...
         mgsheader = """To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

""" % (to_addr,from_addr)
         Trainingool.send_mail(mgsheader+msgbody, to_addr,
from_addr, ...
         ^^^^^^^^^^^^^^^^
--------------------------------------------------

This method is defined in COREBlog2/COREBlogTool.py from
line 238. And 
this uses send() method of SecureMailHost. But this method
can't handle BCC.

To handle BCC, using secureSend() method of SecureMailHost
is needed. 
But this approach seems to be a bit trouble. How about
taking separate 
sending approach?

To send mail separately, you can use 'for' loop for
addr_list.
For example:

--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification():
     try:
         for addr in addr_list:
             to_addr = addr
             ...
--------------------------------------------------


> This might be to ask for to much but i will still ask,
is it a hard job 
> to add a check box (notify me when furter comments are
added to this 
> post) in the comment form and have the  mails selected
bu this check box?

It seems to be hard. At least beyond my reach.


Regards,

-- 
Yusuke NAKAI

mail: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-21 06:49:05
Thanx again,

I have not had the time to check the last code but i'm sure it will work fine.

The checkbox is also fine to leave out, the only problem would be if someone gets mail and tells me he don't like to have it, but they will have to live with it. I always have the possibility to erase their address in the comment.

Is it ok if i add a feature request and adds this sample code? and adds you to the reference Mr NAKAI?

/Niklas



On 12/20/06, Yusuke NAKAI < nyusukenagosui.org">nyusukenagosui.org> wrote:
Hi,

> I tried to find where to change to BCC but could not find the right
> reference, i agree with this beeing a problem, is it hard to change?.

Notification mail is send by cbtool.send_mail() method:

--------------------------------------------------
&nbsp; &nbsp; &nbsp; &nbsp;  ...
   ; &nbsp; &nbsp;  mgsheader = "&quot;"To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

"""; % (to_addr,from_addr)
  ; &nbsp; &nbsp; &nbsp; cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, ...
   ; &nbsp; &nbsp;  ^^^^^^^^^^^^^^^^
--------------------------------------------------

This method is defined in COREBlog2/COREBlogTool.py from line 238. And
this uses send() method of SecureMailHost. But this method can't handle BCC.

To handle BCC, using secureSend() method of SecureMailHost is needed.
But this approach seems to be a bit trouble. How about taking separate
sending approach?

To send mail separately, you can use 'for&#39; loop for addr_list.
For example:

--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification ():
&nbsp; &nbsp;  try:
 ; &nbsp; &nbsp; &nbsp;  for addr in addr_list:
 &nbsp; &nbsp; &nbsp; &nbsp;   ;  to_addr = addr
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; ...
--------------------------------------------------


> This might be to ask for to much but i will still ask, is it a hard job
> to add a check box (notify me when furter comments are added to this
> post) in the comment form and have the &nbsp;mails selected bu this check box?

It seems to be hard. At least beyond my reach.


Regards,

--
Yusuke NAKAI

mail: nyusukenagosui.org">nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com">COREblog-enpostaria.com
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com">coreblog-en-leavepostaria.com



--
With best regards / med vänlig hälsning

Niklas
Comment reply handling
user name
2006-12-22 11:05:22
Hi again,

This how i have solved it now, it probably could be done in a better way but at least it seems to be working:

I have added the send mail function twice to be able to get the full information to the blog admin but only the "comment added"; and URL to the commentators.

Also i have moved the send notification flag to commentators part as the blog admin always should be notified but now i can turn off the commentator notification.

I only have one small problem left, with this aproach the commentator gets a notification mail even when he makes the comment himself, is there anyone who knows an easy way to fix that, it would be very welcome .


---------------------------------------------------------------------------------------------

#Send notify mail to blog admin

try:
 &nbsp;  to_addr&nbsp;  = context.getNotify_to()
 &nbsp;  from_addr = context.getNotify_from ()
   ; msgbody = context.translate(9;comment_notify_body&#39;)
 ; &nbsp; elements = {}
 &nbsp;  for k in ('title',';author';,'url&#39;,'body'):
  ; &nbsp; &nbsp;  if REQUEST.form.has_key(k):
 &nbsp;   ; &nbsp; &nbsp; &nbsp; elements[k] = REQUEST.form[k]
&nbsp; &nbsp; &nbsp; &nbsp; else:
&nbsp; &nbsp; &nbsp; &nbsp;   ;  elements[k] = ''
 &nbsp;  elements[&#39;post_ip'] = REQUEST.getClientAddr()
 &nbsp;  elements[&#39;entry_url'] = context.absolute_url()
 &nbsp;  msgbody = msgbody % (elements)
 &nbsp;  msgsubject = context.translate(9;comment_notify_title')
&nbsp; &nbsp; mgsheader = "&quot;"To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

"""; % (to_addr,from_addr)
  ;  cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, msgsubject)

 &nbsp;  if context.getSend_comment_notification():
&nbsp; &nbsp; &nbsp;   #Get email addresses
  ; &nbsp; &nbsp;  com_list = context.getComment()
  ; &nbsp; &nbsp;  addr_list = []
   ; &nbsp; &nbsp; for com in com_list:
  ; &nbsp; &nbsp; &nbsp; &nbsp;  if not addr_list.count(com.getEmail()):
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; addr_list.append(com.getEmail())

 &nbsp;  #Send notify mail if need to commentators

 &nbsp;   ; &nbsp; try:
 ; &nbsp; &nbsp; &nbsp; &nbsp;   for addr in addr_list:
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; to_addr = addr
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  from_addr = context.getNotify_from()
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   msgbody = context.absolute_url()
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; msgsubject = context.translate(9;comment_notify_title')
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  mgsheader = "&quot;"To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

"""; % (to_addr,from_addr)
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, msgsubject)

 &nbsp;   ; &nbsp; except Exception,e:
 &nbsp; &nbsp;   ; &nbsp; &nbsp;  log( 'COREBlog2/cbaddComment: '
&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   'Some exception occured, %s' % e )

 &nbsp;
except Exception,e:
 &nbsp;  log( 'COREBlog2/cbaddComment: '
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; 'Some exception occured, %s' % e )

---------------------------------------------------------------------------------------------





On 12/21/06, Niklas < nekstrandgmail.com">nekstrandgmail.com> wrote:
Thanx again,

I have not had the time to check the last code but i'm sure it will work fine.

The checkbox is also fine to leave out, the only problem would be if someone gets mail and tells me he don't like to have it, but they will have to live with it. I always have the possibility to erase their address in the comment.

Is it ok if i add a feature request and adds this sample code? and adds you to the reference Mr NAKAI?

/Niklas




On 12/20/06, Yusuke NAKAI < nyusukenagosui.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nyusukenagosui.org> wrote:
Hi,

>; I tried to find where to change to BCC but could not find the right
> reference, i agree with this beeing a problem, is it hard to change?.

Notification mail is send by cbtool.send_mail() method:

--------------------------------------------------
&nbsp; &nbsp; &nbsp;   ; ...
   ; &nbsp; &nbsp;  mgsheader = "&quot;"To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

"""; % (to_addr,from_addr)
  ; &nbsp; &nbsp; &nbsp; cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, ...
   ; &nbsp; &nbsp;  ^^^^^^^^^^^^^^^^
--------------------------------------------------

This method is defined in COREBlog2/COREBlogTool.py from line 238. And
this uses send() method of SecureMailHost. But this method can't handle BCC.

To handle BCC, using secureSend() method of SecureMailHost is needed.
But this approach seems to be a bit trouble. How about taking separate
sending approach?

To send mail separately, you can use 'for&#39; loop for addr_list.
For example:

--------------------------------------------------
#Send notify mail if need
if context.getSend_comment_notification ():
&nbsp;   ; try:
 ; &nbsp; &nbsp; &nbsp;  for addr in addr_list:
 &nbsp; &nbsp; &nbsp; &nbsp;   ;  to_addr = addr
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; ...
--------------------------------------------------


> This might be to ask for to much but i will still ask, is it a hard job
> to add a check box (notify me when furter comments are added to this
> post) in the comment form and have the &nbsp;mails selected bu this check box?

It seems to be hard. At least beyond my reach.


Regards,

--
Yusuke NAKAI

mail: nyusukenagosui.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">COREblog-enpostaria.com
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">coreblog-en-leavepostaria.com



--
With best regards / med vänlig hälsning

Niklas



--
With best regards / med vänlig hälsning

Niklas
Comment reply handling
user name
2006-12-22 17:11:34
Hi,

> I only have one small problem left, with this aproach
the commentator 
> gets a notification mail even when he makes the comment
himself

Email address being posted is got by 'REQUEST.form[email]'
(if entered). 
So you can check if it's included in 'addr_list' before
sending 
notification email.

For example:
--------------------------------------------------
for addr in addr_list:
     if addr == REQUEST.form[email]:
         continue
     else:
         to_addr = addr
         from_addr = context.getNotify_from()
         ...
--------------------------------------------------

Regards,

-- 
Yusuke NAKAI

mail: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-23 05:03:10
On Sat, 23 Dec 2006 02:11:34 +0900, wrote:
> for addr in addr_list:
>      if addr == REQUEST.form[email]:

This line should be...

>      if addr == REQUEST.form['email']:

Regards.

----------------------------------------
Atsushi Shibata (Webcore Corp.)
shibatawebcore.co.jp
http://www.webcore.co.jp/
----------------------------------------
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-23 05:30:06
Hi,

>> for addr in addr_list:
>>      if addr == REQUEST.form[email]:
> 
> This line should be...
> 
>>      if addr == REQUEST.form['email']:

Sorry for my mistake...

Regards,

-- 
Yusuke NAKAI

mail: nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com
http
://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com
Comment reply handling
user name
2006-12-23 13:00:38
Thanx a lot to you all for the help,

It is now working very well, i (as blog administrator) get a comment&nbsp; notification with all information on every comment added, commentators get a notification of all added comments exept when they write their own but only with the url as information.

Blog admin always gets a notification, commentator notification can be dissabled by send notification setting and by letting the commentators leave ; the email field empty (i have not tested the last option but i guess it would work).

Here is the "final" code for the record:

-----------------------------------------------------
#Send notify mail to blog admin
try:
 &nbsp;  to_addr&nbsp;  = context.getNotify_to()
 &nbsp;  from_addr = context.getNotify_from()
   ; msgbody = context.translate(9;comment_notify_body&#39;)
 ; &nbsp; elements = {}
 &nbsp;  for k in ('title',';author';,'url&#39;,'body'):
  ; &nbsp; &nbsp;  if REQUEST.form.has_key (k):
   ; &nbsp; &nbsp; &nbsp; &nbsp; elements[k] = REQUEST.form[k]
 ; &nbsp; &nbsp; &nbsp; else:
&nbsp; &nbsp; &nbsp; &nbsp;   ;  elements[k] = ''
 &nbsp;  elements[&#39;post_ip'] = REQUEST.getClientAddr()
 &nbsp;  elements[&#39;entry_url'] = context.absolute_url ()
 &nbsp;  msgbody = msgbody % (elements)
 &nbsp;  msgsubject = context.translate(9;comment_notify_title')
&nbsp; &nbsp; mgsheader = "&quot;"To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

";"&quot; % (to_addr,from_addr)
&nbsp;   cbtool.send_mail(mgsheader+msgbody, to_addr, from_addr, msgsubject)

# check status of notification mail setting
&nbsp; &nbsp; if context.getSend_comment_notification ():

#Get email addresses for commentators
 &nbsp; &nbsp;   ; com_list = context.getComment()
  ; &nbsp; &nbsp;  addr_list = []
 &nbsp;   ; &nbsp; for com in com_list:
  ; &nbsp; &nbsp; &nbsp; &nbsp;  if not addr_list.count(com.getEmail()):
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; addr_list.append( com.getEmail())

#Send notify mail if need to commentators

 &nbsp;   ; &nbsp; try:
 ; &nbsp; &nbsp; &nbsp; &nbsp;   for addr in addr_list:
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; if addr == REQUEST.form['email']:
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; continue
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; else:
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; to_addr = addr
 ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp;  from_addr = context.getNotify_from()
 &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp;  msgbody = context.absolute_url()
 &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   msgsubject = context.translate(9;comment_notify_title')
&nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; mgsheader = "&quot;"To: %s
From: %s
Mime-Version: 1.0
Content-Type: text/plain; Charset=utf-8

"""; % (to_addr,from_addr)
&nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; cbtool.send_mail (mgsheader+msgbody, to_addr, from_addr, msgsubject)

 &nbsp; &nbsp;   ; except Exception,e:
 &nbsp; &nbsp;   ; &nbsp; &nbsp;  log( 'COREBlog2/cbaddComment: '
&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   'Some exception occured, %s' % e )

 &nbsp;
except Exception,e:
 &nbsp;  log( 'COREBlog2/cbaddComment: '
&nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; 'Some exception occured, %s' % e )
-----------------------------------------------------

On 12/23/06, Yusuke NAKAI < nyusukenagosui.org">nyusukenagosui.org> wrote:
Hi,

>> for addr in addr_list:
>>&nbsp; &nbsp;   ;if addr == REQUEST.form[email]:
>
> This line should be...
>
>>&nbsp; &nbsp;   ;if addr == REQUEST.form['email']:

Sorry for my mistake...

Regards,

--
Yusuke NAKAI

mail: nyusukenagosui.org">nyusukenagosui.org
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-enpostaria.com">COREblog-enpostaria.com
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leavepostaria.com">coreblog-en-leavepostaria.com



--
With best regards / med vänlig hälsning

Niklas
[1-16]

about | contact  Other archives ( Real Estate discussion Medical topics )