changeset 2965:0e1860dcb328 maint-0.7

unit test fixes
author Richard Jones <richard@users.sourceforge.net>
date Thu, 25 Nov 2004 23:46:22 +0000
parents d29673626906
children 7922e1244911
files roundup/backends/back_anydbm.py roundup/backends/blobfiles.py roundup/backends/rdbms_common.py test/test_indexer.py
diffstat 4 files changed, 13 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/back_anydbm.py	Thu Nov 25 22:56:14 2004 +0000
+++ b/roundup/backends/back_anydbm.py	Thu Nov 25 23:46:22 2004 +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.146.2.22 2004-11-25 22:56:14 richard Exp $
+#$Id: back_anydbm.py,v 1.146.2.23 2004-11-25 23:46:21 richard 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
 versions >2.1.1 (the dumbdbm fallback in 2.1.1 and earlier has several
@@ -1650,14 +1650,14 @@
                 l.append((STRING, k, m))
             elif isinstance(propclass, Date):
                 try:
-                    date_rng = Range(v, date.Date, offset=timezone)
+                    date_rng = date.Range(v, date.Date, offset=timezone)
                     l.append((DATE, k, date_rng))
                 except ValueError:
                     # If range creation fails - ignore that search parameter
                     pass
             elif isinstance(propclass, Interval):
                 try:
-                    intv_rng = Range(v, date.Interval)
+                    intv_rng = date.Range(v, date.Interval)
                     l.append((INTERVAL, k, intv_rng))
                 except ValueError:
                     # If range creation fails - ignore that search parameter
--- a/roundup/backends/blobfiles.py	Thu Nov 25 22:56:14 2004 +0000
+++ b/roundup/backends/blobfiles.py	Thu Nov 25 23:46:22 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-#$Id: blobfiles.py,v 1.12.2.5 2004-11-25 22:56:14 richard Exp $
+#$Id: blobfiles.py,v 1.12.2.6 2004-11-25 23:46:22 richard Exp $
 '''This module exports file storage for roundup backends.
 Files are stored into a directory hierarchy.
 '''
@@ -146,7 +146,8 @@
         '''
         # determine the name of the file to delete
         name = self.filename(classname, nodeid, property)
-        if os.path.exists(name+".tmp"):
-            os.remove(name+".tmp")
+        if not name.endswith('.tmp'):
+            name += '.tmp'
+        os.remove(name)
 
 # vim: set filetype=python ts=4 sw=4 et si
--- a/roundup/backends/rdbms_common.py	Thu Nov 25 22:56:14 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Thu Nov 25 23:46:22 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.98.2.27 2004-11-10 22:26:07 richard Exp $
+# $Id: rdbms_common.py,v 1.98.2.28 2004-11-25 23:46:22 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -2670,10 +2670,8 @@
         if content:
             # store and index
             self.db.storefile(self.classname, itemid, None, content)
-            if self.getprops().has_key('type'):
-                mime_type = propvalues.get('type', self.get(itemid, 'type',
-                    self.default_mime_type))
-            else:
+            mime_type = propvalues.get('type', self.get(itemid, 'type'))
+            if not mime_type:
                 mime_type = self.default_mime_type
             self.db.indexer.add_text((self.classname, itemid, 'content'),
                 content, mime_type)
--- a/test/test_indexer.py	Thu Nov 25 22:56:14 2004 +0000
+++ b/test/test_indexer.py	Thu Nov 25 23:46:22 2004 +0000
@@ -18,7 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# $Id: test_indexer.py,v 1.4 2004-03-19 04:47:59 richard Exp $
+# $Id: test_indexer.py,v 1.4.2.1 2004-11-25 23:46:22 richard Exp $
 
 import os, unittest, shutil
 
@@ -35,11 +35,10 @@
 
     def test_basics(self):
         self.dex.add_text('testing1', 'a the hello world')
-        self.assertEqual(self.dex.words, {'HELLO': {1: 1}, 'THE': {1: 1},
-            'WORLD': {1: 1}})
+        self.assertEqual(self.dex.words, {'HELLO': {1: 1}, 'WORLD': {1: 1}})
         self.dex.add_text('testing2', 'blah blah the world')
         self.assertEqual(self.dex.words, {'BLAH': {2: 2}, 'HELLO': {1: 1},
-            'THE': {2: 1, 1: 1}, 'WORLD': {2: 1, 1: 1}})
+            'WORLD': {2: 1, 1: 1}})
         self.assertEqual(self.dex.find(['world']), {2: 'testing2',
             1: 'testing1'})
         self.assertEqual(self.dex.find(['blah']), {2: 'testing2'})

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