I just looked at the latest development on the Spambayes front and I was wondering how the close_db and change_db callback functions are supposed to work, especially the change_db function.
The way I understand change_db is that it is supposed to change the values of classifier, message_db and imap_filter in the parent function (the function run in which the callbacks are defined). However, I don't think that works. The parent function variables are not available in change_db, it only defines its own copies which are destroyed when the function returns. close_db may work since it doesn't assign to any variables and so only refers to the variables defined in the parent function. I would suggest a completely different way: at the top of the loop in the run function, open the database and create the filter, and at the end of the loop, before the sleep, close the database. If it is inefficient to open the database (e.g. when using a pickle), this may not be a good idea, but otherwise I guess it's not too bad. Alternatively, use a class and use instance variables for classifier et al. -- Sjoerd Mullender
signature.asc
Description: OpenPGP digital signature
_______________________________________________ spambayes-dev mailing list spambayes-dev@python.org http://mail.python.org/mailman/listinfo/spambayes-dev