Toby Smithe | 9 Jun 23:25
Picon

comment.py: send_email dies when called from pingback

Hi,

because pingbacks do not set the "comment_smtp_from" variable,
send_email dies in the case (like mine) where the user has not set
that variable in the config dict. I've applied the following patch,
but I realise it may be undesirable. However, it makes more sense for
me for the comments to be SMTP From the given e-mail, using the
configured value as a fall-back, and the "to" value as a last resort.
In any case, I don't like that there is a use-case where the function
can fail.

=== modified file 'plugins/comments.py'
--- plugins/comments.py 2009-06-06 11:08:52 +0000
+++ plugins/comments.py 2009-06-09 21:08:05 +0000
@@ -499,10 +503,13 @@
     description = escape_SMTP_commands(comment['description'])
     ipaddress = escape_SMTP_commands(comment.get('ipaddress', '?'))

-    if 'comment_smtp_from' in config:
-        email = config['comment_smtp_from']
-    else:
+    try:
         email = escape_SMTP_commands(clean_author(comment['email']))
+    except:
+        if 'comment_smtp_from' in config:
+            email = config['comment_smtp_from']
+        else:
+            email = config['comment_smtp_to']

     try:
         curl = "%s/%s" % (config['base_url'],

Regards,

--

-- 
Toby Smithe :: http://fulltinreality.com

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects

Gmane