diff roundup/backends/rdbms_common.py @ 2893:17df4dc4ae51 maint-0.7

merge from HEAD
author Richard Jones <richard@users.sourceforge.net>
date Wed, 10 Nov 2004 22:26:07 +0000
parents 95a8b49090de
children 0e1860dcb328
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Tue Nov 09 04:10:28 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Wed Nov 10 22:26:07 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.98.2.26 2004-11-09 04:10:28 richard Exp $
+# $Id: rdbms_common.py,v 1.98.2.27 2004-11-10 22:26:07 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -1420,7 +1420,9 @@
             elif isinstance(prop, String):
                 if type(value) != type('') and type(value) != type(u''):
                     raise TypeError, 'new property "%s" not a string'%key
-                self.db.indexer.add_text((self.classname, newid, key), value)
+                if prop.indexme:
+                    self.db.indexer.add_text((self.classname, newid, key),
+                        value)
 
             elif isinstance(prop, Password):
                 if not isinstance(value, password.Password):
@@ -1696,8 +1698,9 @@
             elif isinstance(prop, String):
                 if value is not None and type(value) != type('') and type(value) != type(u''):
                     raise TypeError, 'new property "%s" not a string'%propname
-                self.db.indexer.add_text((self.classname, nodeid, propname),
-                    value)
+                if prop.indexme:
+                    self.db.indexer.add_text((self.classname, nodeid, propname),
+                        value)
 
             elif isinstance(prop, Password):
                 if not isinstance(value, password.Password):
@@ -2489,11 +2492,14 @@
                 pwd.unpack(value)
                 value = pwd
             d[propname] = value
-            if isinstance(prop, String) and prop.indexme:
+            if isinstance(prop, String):
                 if type(value) != type('') and type(value) != type(u''):
-                    raise TypeError, 'new property "%s" not a string'%key
-                self.db.indexer.add_text((self.classname, newid, propname),
-                    value)
+                    raise TypeError, \
+                        'new property "%(propname)s" not a string: %(value)r' \
+                        % locals()
+                if prop.indexme:
+                    self.db.indexer.add_text((self.classname, newid, propname),
+                        value)
 
         # get a new id if necessary
         if newid is None:

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