Mercurial > p > roundup > code
comparison roundup/backends/rdbms_common.py @ 2892:2eae5848912d
always honor indexme property on Strings (patch [SF#063711])
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 10 Nov 2004 22:22:59 +0000 |
| parents | 23ed4195e442 |
| children | 2ddba486546a |
comparison
equal
deleted
inserted
replaced
| 2891:bc72b1c7319b | 2892:2eae5848912d |
|---|---|
| 1 # $Id: rdbms_common.py,v 1.139 2004-11-09 04:07:54 richard Exp $ | 1 # $Id: rdbms_common.py,v 1.140 2004-11-10 22:22:58 richard Exp $ |
| 2 ''' Relational database (SQL) backend common code. | 2 ''' Relational database (SQL) backend common code. |
| 3 | 3 |
| 4 Basics: | 4 Basics: |
| 5 | 5 |
| 6 - map roundup classes to relational tables | 6 - map roundup classes to relational tables |
| 1377 (self.classname, newid, key)) | 1377 (self.classname, newid, key)) |
| 1378 | 1378 |
| 1379 elif isinstance(prop, String): | 1379 elif isinstance(prop, String): |
| 1380 if type(value) != type('') and type(value) != type(u''): | 1380 if type(value) != type('') and type(value) != type(u''): |
| 1381 raise TypeError, 'new property "%s" not a string'%key | 1381 raise TypeError, 'new property "%s" not a string'%key |
| 1382 self.db.indexer.add_text((self.classname, newid, key), value) | 1382 if prop.indexme: |
| 1383 self.db.indexer.add_text((self.classname, newid, key), | |
| 1384 value) | |
| 1383 | 1385 |
| 1384 elif isinstance(prop, Password): | 1386 elif isinstance(prop, Password): |
| 1385 if not isinstance(value, password.Password): | 1387 if not isinstance(value, password.Password): |
| 1386 raise TypeError, 'new property "%s" not a Password'%key | 1388 raise TypeError, 'new property "%s" not a Password'%key |
| 1387 | 1389 |
| 1654 journalvalues[propname] = tuple(l) | 1656 journalvalues[propname] = tuple(l) |
| 1655 | 1657 |
| 1656 elif isinstance(prop, String): | 1658 elif isinstance(prop, String): |
| 1657 if value is not None and type(value) != type('') and type(value) != type(u''): | 1659 if value is not None and type(value) != type('') and type(value) != type(u''): |
| 1658 raise TypeError, 'new property "%s" not a string'%propname | 1660 raise TypeError, 'new property "%s" not a string'%propname |
| 1659 self.db.indexer.add_text((self.classname, nodeid, propname), | 1661 if prop.indexme: |
| 1660 value) | 1662 self.db.indexer.add_text((self.classname, nodeid, propname), |
| 1663 value) | |
| 1661 | 1664 |
| 1662 elif isinstance(prop, Password): | 1665 elif isinstance(prop, Password): |
| 1663 if not isinstance(value, password.Password): | 1666 if not isinstance(value, password.Password): |
| 1664 raise TypeError, 'new property "%s" not a Password'%propname | 1667 raise TypeError, 'new property "%s" not a Password'%propname |
| 1665 propvalues[propname] = value | 1668 propvalues[propname] = value |
| 2426 elif isinstance(prop, hyperdb.Password): | 2429 elif isinstance(prop, hyperdb.Password): |
| 2427 pwd = password.Password() | 2430 pwd = password.Password() |
| 2428 pwd.unpack(value) | 2431 pwd.unpack(value) |
| 2429 value = pwd | 2432 value = pwd |
| 2430 d[propname] = value | 2433 d[propname] = value |
| 2431 if isinstance(prop, String) and prop.indexme: | 2434 if isinstance(prop, String): |
| 2432 if type(value) != type('') and type(value) != type(u''): | 2435 if type(value) != type('') and type(value) != type(u''): |
| 2433 raise TypeError, \ | 2436 raise TypeError, \ |
| 2434 'new property "%(propname)s" not a string: %(value)r' \ | 2437 'new property "%(propname)s" not a string: %(value)r' \ |
| 2435 % locals() | 2438 % locals() |
| 2436 self.db.indexer.add_text((self.classname, newid, propname), | 2439 if prop.indexme: |
| 2437 value) | 2440 self.db.indexer.add_text((self.classname, newid, propname), |
| 2441 value) | |
| 2438 | 2442 |
| 2439 # get a new id if necessary | 2443 # get a new id if necessary |
| 2440 if newid is None: | 2444 if newid is None: |
| 2441 newid = self.db.newid(self.classname) | 2445 newid = self.db.newid(self.classname) |
| 2442 | 2446 |
