comparison roundup/backends/blobfiles.py @ 818:254b8d112eec

cleaned up the indexer code: - it splits more words out (much simpler, faster splitter) - removed code we'll never use (roundup.roundup_indexer has the full implementation, and replaces roundup.indexer) - only index text/plain and rfc822/message (ideas for other text formats to index are welcome) - added simple unit test for indexer. Needs more tests for regression.
author Richard Jones <richard@users.sourceforge.net>
date Mon, 08 Jul 2002 06:58:15 +0000
parents fb2ce2b8b2ef
children 0779ea9f1f18
comparison
equal deleted inserted replaced
817:fd56b481797d 818:254b8d112eec
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 #$Id: blobfiles.py,v 1.4 2002-06-19 03:07:19 richard Exp $ 18 #$Id: blobfiles.py,v 1.5 2002-07-08 06:58:15 richard Exp $
19 ''' 19 '''
20 This module exports file storage for roundup backends. 20 This module exports file storage for roundup backends.
21 Files are stored into a directory hierarchy. 21 Files are stored into a directory hierarchy.
22 ''' 22 '''
23 23
24 import os, os.path 24 import os
25 25
26 def files_in_dir(dir): 26 def files_in_dir(dir):
27 if not os.path.exists(dir): 27 if not os.path.exists(dir):
28 return 0 28 return 0
29 num_files = 0 29 num_files = 0
104 def _doStoreFile(self, name, **databases): 104 def _doStoreFile(self, name, **databases):
105 '''Store the file as part of a transaction commit. 105 '''Store the file as part of a transaction commit.
106 ''' 106 '''
107 # the file is currently ".tmp" - move it to its real name to commit 107 # the file is currently ".tmp" - move it to its real name to commit
108 os.rename(name+".tmp", name) 108 os.rename(name+".tmp", name)
109 pattern = name.split('/')[-1] 109 self.indexer.add_file(name)
110 self.indexer.add_files(dir=os.path.dirname(name), pattern=pattern)
111 self.indexer.save_index() 110 self.indexer.save_index()
112 111
113 # $Log: not supported by cvs2svn $ 112 # $Log: not supported by cvs2svn $
113 # Revision 1.4 2002/06/19 03:07:19 richard
114 # Moved the file storage commit into blobfiles where it belongs.
115 #
114 # Revision 1.3 2002/02/27 07:33:34 grubert 116 # Revision 1.3 2002/02/27 07:33:34 grubert
115 # . add, vim line and cvs log key. 117 # . add, vim line and cvs log key.
116 # 118 #
117 # 119 #
118 # vim: set filetype=python ts=4 sw=4 et si 120 # vim: set filetype=python ts=4 sw=4 et si

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