Re: Comment reply handling

Yusuke NAKAI <[email protected]> Tue, 19 Dec 2006 01:55:17 +0900
Newsgroups gmane.comp.python.zope.coreblog.english
Message-ID <[email protected]>
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: [email protected]
  - Notify To: [email protected]
  - checked 'Require email'


Let's see some cases.

1.To send notification mail
  from [email protected]
  to [email protected],
  no customization is needed(default action).

2.To send notification mail
  from [email protected]
  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 [email protected],
  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 = '[email protected]'
         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: [email protected]
web : http://nagosui.org
_______________________________________________
COREblog-en mailing list
COREblog-en-/9qXvnWia/9Wk0Htik3J/[email protected]
http://postaria.com/mailman/listinfo/coreblog-en
Unsubscription writing to coreblog-en-leave-/9qXvnWia/9Wk0Htik3J/[email protected]