[Spambayes-checkins] spambayes pop3proxy.py,1.93,1.94
Richie Hindle
richiehindle at users.sourceforge.net
Sat Aug 30 16:27:46 EDT 2003
Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv24897
Modified Files:
pop3proxy.py
Log Message:
The X-Spambayes-Exception header now includes a traceback as
well as the exception.
Index: pop3proxy.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/pop3proxy.py,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** pop3proxy.py 26 Aug 2003 01:21:40 -0000 1.93
--- pop3proxy.py 30 Aug 2003 22:27:44 -0000 1.94
***************
*** 89,98 ****
"""
! import os, sys, re, errno, getopt, time, traceback
! import socket
from thread import start_new_thread
from email.Header import Header
- import smtpproxy
import spambayes.message
from spambayes import Dibbler
--- 89,96 ----
"""
! import os, sys, re, errno, getopt, time, traceback, socket, cStringIO
from thread import start_new_thread
from email.Header import Header
import spambayes.message
from spambayes import Dibbler
***************
*** 491,494 ****
--- 489,494 ----
messageText = "\r\n".join(headers) + "\r\n\r\n" + body
+ crashMe()
+
except:
# Something nasty happened while parsing or classifying -
***************
*** 496,509 ****
# This is one case where an unqualified 'except' is OK, 'cos
# anything's better than destroying people's email...
! eType, eValue, eTraceback = sys.exc_info()
headerName = 'X-Spambayes-Exception'
! file, line, func, code = traceback.extract_tb(eTraceback)[-1]
!
! # Build the header.
! details = "%s(%s) in %s() at %s line %d: %s" % \
! (eType, eValue, func, file, line, code)
! header = Header(details, header_name=headerName,
! continuation_ws='\t')
!
# Insert the header, converting email.Header's '\n' line
# breaks to POP3's '\r\n'.
--- 496,510 ----
# This is one case where an unqualified 'except' is OK, 'cos
# anything's better than destroying people's email...
! stream = cStringIO.StringIO()
! traceback.print_exc(None, stream)
! details = stream.getvalue()
!
! # Build the header. This will strip leading whitespace from
! # the lines, so we add a leading dot to maintain indentation.
! detailLines = details.strip().split('\n')
! dottedDetails = '\n.'.join(detailLines)
headerName = 'X-Spambayes-Exception'
! header = Header(dottedDetails, header_name=headerName)
!
# Insert the header, converting email.Header's '\n' line
# breaks to POP3's '\r\n'.
***************
*** 514,518 ****
# Print the exception and a traceback.
! traceback.print_exc()
# Restore the +OK and the POP3 .\r\n terminator if there was one.
--- 515,519 ----
# Print the exception and a traceback.
! print >>sys.stderr, details
# Restore the +OK and the POP3 .\r\n terminator if there was one.
***************
*** 739,742 ****
--- 740,744 ----
# SMTP proxy information in their configuration, then nothing will
# happen.
+ import smtpproxy
servers, proxyPorts = smtpproxy.LoadServerInfo()
smtpproxy.CreateProxies(servers, proxyPorts, state)
More information about the Spambayes-checkins
mailing list