Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 2888:95a8b49090de | 2893:17df4dc4ae51 |
|---|---|
| 1 # $Id: rdbms_common.py,v 1.98.2.26 2004-11-09 04:10:28 richard Exp $ | 1 # $Id: rdbms_common.py,v 1.98.2.27 2004-11-10 22:26:07 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 |
| 1418 (self.classname, newid, key)) | 1418 (self.classname, newid, key)) |
| 1419 | 1419 |
| 1420 elif isinstance(prop, String): | 1420 elif isinstance(prop, String): |
| 1421 if type(value) != type('') and type(value) != type(u''): | 1421 if type(value) != type('') and type(value) != type(u''): |
| 1422 raise TypeError, 'new property "%s" not a string'%key | 1422 raise TypeError, 'new property "%s" not a string'%key |
| 1423 self.db.indexer.add_text((self.classname, newid, key), value) | 1423 if prop.indexme: |
| 1424 self.db.indexer.add_text((self.classname, newid, key), | |
| 1425 value) | |
| 1424 | 1426 |
| 1425 elif isinstance(prop, Password): | 1427 elif isinstance(prop, Password): |
| 1426 if not isinstance(value, password.Password): | 1428 if not isinstance(value, password.Password): |
| 1427 raise TypeError, 'new property "%s" not a Password'%key | 1429 raise TypeError, 'new property "%s" not a Password'%key |
| 1428 | 1430 |
| 1694 journalvalues[propname] = tuple(l) | 1696 journalvalues[propname] = tuple(l) |
| 1695 | 1697 |
| 1696 elif isinstance(prop, String): | 1698 elif isinstance(prop, String): |
| 1697 if value is not None and type(value) != type('') and type(value) != type(u''): | 1699 if value is not None and type(value) != type('') and type(value) != type(u''): |
| 1698 raise TypeError, 'new property "%s" not a string'%propname | 1700 raise TypeError, 'new property "%s" not a string'%propname |
| 1699 self.db.indexer.add_text((self.classname, nodeid, propname), | 1701 if prop.indexme: |
| 1700 value) | 1702 self.db.indexer.add_text((self.classname, nodeid, propname), |
| 1703 value) | |
| 1701 | 1704 |
| 1702 elif isinstance(prop, Password): | 1705 elif isinstance(prop, Password): |
| 1703 if not isinstance(value, password.Password): | 1706 if not isinstance(value, password.Password): |
| 1704 raise TypeError, 'new property "%s" not a Password'%propname | 1707 raise TypeError, 'new property "%s" not a Password'%propname |
| 1705 propvalues[propname] = value | 1708 propvalues[propname] = value |
| 2487 elif isinstance(prop, hyperdb.Password): | 2490 elif isinstance(prop, hyperdb.Password): |
| 2488 pwd = password.Password() | 2491 pwd = password.Password() |
| 2489 pwd.unpack(value) | 2492 pwd.unpack(value) |
| 2490 value = pwd | 2493 value = pwd |
| 2491 d[propname] = value | 2494 d[propname] = value |
| 2492 if isinstance(prop, String) and prop.indexme: | 2495 if isinstance(prop, String): |
| 2493 if type(value) != type('') and type(value) != type(u''): | 2496 if type(value) != type('') and type(value) != type(u''): |
| 2494 raise TypeError, 'new property "%s" not a string'%key | 2497 raise TypeError, \ |
| 2495 self.db.indexer.add_text((self.classname, newid, propname), | 2498 'new property "%(propname)s" not a string: %(value)r' \ |
| 2496 value) | 2499 % locals() |
| 2500 if prop.indexme: | |
| 2501 self.db.indexer.add_text((self.classname, newid, propname), | |
| 2502 value) | |
| 2497 | 2503 |
| 2498 # get a new id if necessary | 2504 # get a new id if necessary |
| 2499 if newid is None: | 2505 if newid is None: |
| 2500 newid = self.db.newid(self.classname) | 2506 newid = self.db.newid(self.classname) |
| 2501 | 2507 |
