diff roundup/backends/back_anydbm.py @ 681:1b2d0e702ca8 search_indexing-0-4-2-branch

Added feature [SF#526730] - search for messages capability
author Roche Compaan <rochecompaan@users.sourceforge.net>
date Wed, 03 Apr 2002 11:55:57 +0000
parents 9b2575610953
children 54333751e98d
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Wed Apr 03 11:55:57 2002 +0000
+++ b/roundup/backends/back_anydbm.py	Wed Apr 03 11:55:57 2002 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: back_anydbm.py,v 1.30 2002-02-27 03:40:59 richard Exp $
+#$Id: back_anydbm.py,v 1.30.2.1 2002-04-03 11:55:57 rochecompaan Exp $
 '''
 This module defines a backend that saves the hyperdatabase in a database
 chosen by anydbm. It is guaranteed to always be available in python
@@ -26,6 +26,7 @@
 import whichdb, anydbm, os, marshal
 from roundup import hyperdb, date
 from blobfiles import FileStorage
+from roundup.roundup_indexer import RoundupIndexer
 
 #
 # Now the database
@@ -60,6 +61,7 @@
         self.dirtynodes = {}    # keep track of the dirty nodes by class
         self.newnodes = {}      # keep track of the new nodes by class
         self.transactions = []
+        self.indexer = RoundupIndexer(self.dir)
 
     def __repr__(self):
         return '<back_anydbm instance at %x>'%id(self) 
@@ -407,6 +409,9 @@
     def _doStoreFile(self, name, **databases):
         # the file is currently ".tmp" - move it to its real name to commit
         os.rename(name+".tmp", name)
+        pattern = name.split('/')[-1]
+        self.indexer.add_files(dir=os.path.dirname(name), pattern=pattern)
+        self.indexer.save_index()
 
     def rollback(self):
         ''' Reverse all actions from the current transaction.
@@ -425,6 +430,9 @@
 
 #
 #$Log: not supported by cvs2svn $
+#Revision 1.30  2002/02/27 03:40:59  richard
+#Ran it through pychecker, made fixes
+#
 #Revision 1.29  2002/02/25 14:34:31  grubert
 # . use blobfiles in back_anydbm which is used in back_bsddb.
 #   change test_db as dirlist does not work for subdirectories.

Roundup Issue Tracker: http://roundup-tracker.org/