[Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.35,1.36
Tony Meyer
anadelonbrin at users.sourceforge.net
Fri Aug 6 07:23:24 CEST 2004
Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25032/scripts
Modified Files:
sb_imapfilter.py
Log Message:
Fix three bugs found by Sjoerd Mullender:
imap.close() should be self.imap_server.close()
There were some instances of BadIMAPResponse instead of BadIMAPResponseError
(obviously I was confused about what I was calling it when I wrote them).
Need to pass the message id to insert_exception_header, and use self.rfc822_key
as the key.
And one in response to a problem from Aaron Konstam:
isinstance check is wrong, so will never be true, so literals in the folder list will never
be handled correctly.
Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** sb_imapfilter.py 4 Aug 2004 08:32:26 -0000 1.35
--- sb_imapfilter.py 6 Aug 2004 05:23:21 -0000 1.36
***************
*** 205,209 ****
# a list of all the deleted messages which we don't do
# anything with).
! imap.close()
if folder == "":
--- 205,209 ----
# a list of all the deleted messages which we don't do
# anything with).
! self.imap_server.close()
if folder == "":
***************
*** 236,242 ****
# Sigh. Some servers may give us back the folder name as a
# literal, so we need to crunch this out.
! if isinstance(fol, ()):
! r = re.compile(r"{\d+}")
! m = r.search(fol[0])
if not m:
# Something is wrong here! Skip this folder.
--- 236,241 ----
# Sigh. Some servers may give us back the folder name as a
# literal, so we need to crunch this out.
! if isinstance(fol, types.TupleType):
! m = re.search(r"{\d+}", fol[0])
if not m:
# Something is wrong here! Skip this folder.
***************
*** 381,385 ****
try:
self.imap_server.SelectFolder(self.folder.name)
! except BadIMAPResponse:
# Can't select the folder, so getting the substance will not
# work.
--- 380,384 ----
try:
self.imap_server.SelectFolder(self.folder.name)
! except BadIMAPResponseError:
# Can't select the folder, so getting the substance will not
# work.
***************
*** 435,439 ****
# exception data and then the original message.
self.invalid = True
! text, details = message.insert_exception_header(data["RFC822"])
self.invalid_content = text
self.got_substance = True
--- 434,439 ----
# exception data and then the original message.
self.invalid = True
! text, details = message.insert_exception_header(
! data[self.rfc822_key], self.id)
self.invalid_content = text
self.got_substance = True
***************
*** 518,522 ****
try:
self.imap_server.check_response("", response)
! except BadIMAPResponse:
pass
else:
--- 518,522 ----
try:
self.imap_server.check_response("", response)
! except BadIMAPResponseError:
pass
else:
***************
*** 848,852 ****
try:
self.imap_server.SelectFolder(self.unsure_folder.name)
! except BadIMAPResponse:
print "Cannot select spam folder. Please check configuration."
sys.exit(-1)
--- 848,852 ----
try:
self.imap_server.SelectFolder(self.unsure_folder.name)
! except BadIMAPResponseError:
print "Cannot select spam folder. Please check configuration."
sys.exit(-1)
***************
*** 856,860 ****
try:
self.imap_server.SelectFolder(filter_folder)
! except BadIMAPResponse:
print "Cannot select %s, skipping." % (filter_folder,)
continue
--- 856,860 ----
try:
self.imap_server.SelectFolder(filter_folder)
! except BadIMAPResponseError:
print "Cannot select %s, skipping." % (filter_folder,)
continue
More information about the Spambayes-checkins
mailing list