[spambayes-dev] Use of email factory function

Sjoerd Mullender sjoerd at acm.org
Thu Aug 5 15:59:53 CEST 2004


Sjoerd Mullender wrote:
> Tony Meyer wrote:
> 
>>> If we can do something that returns self the first time it is called 
>>> and a (truly) new instance for all subsequent calls, it
>>> might work. Something like this, perhaps:
>>
>>
>> [...]
>>
>> I've just checked in lots of changes (and some tests!) to sb_imapfilter.
>> You're running from CVS, yes?  If so, if you could see if they break 
>> it for
>> you (don't for me), that would be great.  There are lots of changes, so
>> running on somewhere safe would be good...
> 
> 
> It doesn't work and I wonder how it can work in your environment.  The 
> problem is that you use both BadIMAPResponse and BadIMAPResponseError to 
> raise exceptions, but only the latter is actually defined.
> 
> Also, since in sb_imapfilter.py imap is no longer a global variable, the 
> call to imap.close() in IMAPSession.SelectFolder() causes a NameError 
> exception.  Should that be self.close() instead?

More problems:
When a message can't be parsed in IMAPMessage.get_full_message, 
message.insert_exception_header is called.  The argument is 
data["RFC822"], but that key doesn't exist.  It should be 
self.rfc822_key instead.

And then there is a reference to "self" in insert_exception_header, so 
that causes NameError exception.  I don't know whether it is still 
necessary to insert a mailid header in the message after your Message-Id 
changes, but if so, maybe the id should be passed as a parameter?

>> I have made a change to fix this problem, along the lines (but not 
>> quite the
>> same) as what you suggested.  I've also changed from always using our 
>> own ID
>> to using the Message-ID header when possible (but it should still pick up
>> the old ones and not retrain/filter them).
>>
>> Interested to know what you think... :)
>>
>> =Tony Meyer
>>
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> spambayes-dev mailing list
> spambayes-dev at python.org
> http://mail.python.org/mailman/listinfo/spambayes-dev


-- 
Sjoerd Mullender <sjoerd at acm.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 374 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/spambayes-dev/attachments/20040805/2260f115/signature.pgp


More information about the spambayes-dev mailing list