[Spambayes-checkins] spambayes/scripts sb_imapfilter.py,1.64,1.65
Tony Meyer
anadelonbrin at users.sourceforge.net
Mon Nov 28 11:57:13 CET 2005
Update of /cvsroot/spambayes/spambayes/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16550/scripts
Modified Files:
sb_imapfilter.py
Log Message:
Handle database changes while filter is running.
Actually, there will still be problems if it is changing while the filter is actually
running, rather than waiting to run next; fixing that would be somewhat more complicated.
Index: sb_imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/scripts/sb_imapfilter.py,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** sb_imapfilter.py 27 Nov 2005 12:40:07 -0000 1.64
--- sb_imapfilter.py 28 Nov 2005 10:57:07 -0000 1.65
***************
*** 146,150 ****
from spambayes import message
from spambayes.Options import options, get_pathname_option, optionsPathname
! from spambayes import tokenizer, storage, message, Dibbler
from spambayes.UserInterface import UserInterfaceServer
from spambayes.ImapUI import IMAPUserInterface, LoginFailure
--- 146,150 ----
from spambayes import message
from spambayes.Options import options, get_pathname_option, optionsPathname
! from spambayes import tokenizer, storage, Dibbler
from spambayes.UserInterface import UserInterfaceServer
from spambayes.ImapUI import IMAPUserInterface, LoginFailure
***************
*** 1185,1191 ****
imaps.append(IMAPSession(server, port, imapDebug, doExpunge))
httpServer = UserInterfaceServer(options["html_ui", "port"])
httpServer.register(IMAPUserInterface(classifier, imaps, pwds,
! IMAPSession, stats=stats))
launchBrowser=launchUI or options["html_ui", "launch_browser"]
if sleepTime:
--- 1185,1207 ----
imaps.append(IMAPSession(server, port, imapDebug, doExpunge))
+ def close_db():
+ message_db.store()
+ message_db.close()
+ message.Message().message_info_db.store()
+ message.Message().message_info_db.close()
+ message.Message.message_info_db = None
+ classifier.store()
+ classifier.close()
+
+ def change_db():
+ classifier = storage.open_storage(*storage.database_type(opts))
+ message_db = message.open_storage(*message.database_type())
+ imap_filter = IMAPFilter(classifier, message_db)
+
httpServer = UserInterfaceServer(options["html_ui", "port"])
httpServer.register(IMAPUserInterface(classifier, imaps, pwds,
! IMAPSession, stats=stats,
! close_db=close_db,
! change_db=change_db))
launchBrowser=launchUI or options["html_ui", "launch_browser"]
if sleepTime:
More information about the Spambayes-checkins
mailing list