spambayes/spambayes Corpus.py, 1.22, 1.23 FileCorpus.py, 1.19, 1.20

"Tony Meyer" <[email protected]>
Newsgroups gmane.mail.spam.spambayes.cvs
Message-ID <[email protected]>
Update of /cvsroot/spambayes/spambayes/spambayes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27215/spambayes

Modified Files:
	Corpus.py FileCorpus.py 
Log Message:
Fix [ 1182671 ] When cache directories are full, 1.1a1 starts slowly

We re-opened the message database for every message in the corpus directory.  We are meant to open it once and keep track of it.

Index: Corpus.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/Corpus.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** Corpus.py	18 Mar 2005 01:57:28 -0000	1.22
--- Corpus.py	22 Apr 2005 07:15:09 -0000	1.23
***************
*** 253,261 ****
  class MessageFactory:
      '''Abstract Message Factory'''
- 
-     def __init__(self):
-         '''Constructor()'''
-         pass
- 
      def create(self, key, content=None):
          '''Create a message instance'''
--- 253,256 ----

Index: FileCorpus.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/spambayes/FileCorpus.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** FileCorpus.py	18 Mar 2005 01:57:28 -0000	1.19
--- FileCorpus.py	22 Apr 2005 07:15:09 -0000	1.20
***************
*** 148,157 ****
      '''Message that persists as a file system artifact.'''
  
!     def __init__(self, file_name=None, directory=None):
          '''Constructor(message file name, corpus directory name)'''
          self.file_name = file_name
          self.directory = directory
          self.loaded = False
!         self._msg = message.SBHeaderMessage()
  
      def __getattr__(self, att):
--- 148,158 ----
      '''Message that persists as a file system artifact.'''
  
!     def __init__(self, file_name=None, directory=None,
!                  message_database=None):
          '''Constructor(message file name, corpus directory name)'''
          self.file_name = file_name
          self.directory = directory
          self.loaded = False
!         self._msg = message.SBHeaderMessage(message_info_db=message_database)
  
      def __getattr__(self, att):
***************
*** 298,301 ****
--- 299,306 ----
      # Subclass must define a concrete message klass.
      klass = None
+     def __init__(self, message_database=None):
+         self.message_database = message_database
+         Corpus.MessageFactory.__init__(self)
+         
      def create(self, key, directory, content=None):
          '''Create a message object from a filename in a directory'''
***************
*** 307,311 ****
              msg.loaded = True
              return msg
!         return self.klass(key, directory)
      
  
--- 312,316 ----
              msg.loaded = True
              return msg
!         return self.klass(key, directory, self.message_database)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.