Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6978/spambayes

Modified Files:
      Tag: release_1_0-branch
        message.py 
Log Message:
Backport fix for setPaylod with Python 2.4.

Index: message.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/message.py,v
retrieving revision 1.49.4.5
retrieving revision 1.49.4.6
diff -C2 -d -r1.49.4.5 -r1.49.4.6
*** message.py  22 Nov 2004 23:38:34 -0000      1.49.4.5
--- message.py  20 Dec 2004 04:09:28 -0000      1.49.4.6
***************
*** 243,254 ****
      # imapfilter has an example of this in action
      def setPayload(self, payload):
!         prs = email.Parser.Parser()
!         fp = StringIO.StringIO(payload)
!         # this is kindof a hack, due to the fact that the parser creates a
!         # new message object, and we already have the message object
!         prs._parseheaders(self, fp)
!         # we may want to do some header parsing error handling here
!         # to try to extract important headers regardless of malformations
!         prs._parsebody(self, fp)
  
      def setId(self, id):
--- 243,252 ----
      # imapfilter has an example of this in action
      def setPayload(self, payload):
!         # Python 2.4 has a new email package, and the private functions
!         # are gone.  So the old method won't work.  We do this much nicer
!         # with 1.1, but we have to do something to get this to work for the
!         # 1.0.x branch, so use a different ugly hack.
!         new_me = email.message_from_string(payload, _class=Message)
!         self.__dict__ = new_me.__dict__
  
      def setId(self, id):
***************
*** 343,348 ****
      Adds routines to add/remove headers for Spambayes'''
  
!     def __init__(self):
!         Message.__init__(self)
  
      def setIdFromPayload(self):
--- 341,347 ----
      Adds routines to add/remove headers for Spambayes'''
  
!     def setPayload(self, payload):
!         new_me = email.message_from_string(payload, _class=Message)
!         self.__dict__ = new_me.__dict__
  
      def setIdFromPayload(self):

_______________________________________________
Spambayes-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/spambayes-checkins

Reply via email to