Mercurial > p > roundup > code
comparison roundup/backends/rdbms_common.py @ 1523:63aa7be52d2c
checked to make sure that the restored item doesn't clash...
...with a new item using the same key value
| author | Andrey Lebedev <kedder@users.sourceforge.net> |
|---|---|
| date | Mon, 17 Mar 2003 22:03:08 +0000 |
| parents | 6fede2aa6a12 |
| children | 96cd422532ef |
comparison
equal
deleted
inserted
replaced
| 1522:d20680d611a6 | 1523:63aa7be52d2c |
|---|---|
| 1 # $Id: rdbms_common.py,v 1.44 2003-03-16 22:24:55 kedder Exp $ | 1 # $Id: rdbms_common.py,v 1.45 2003-03-17 22:03:08 kedder 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 |
| 1484 Make node available for all operations like it was before retirement. | 1484 Make node available for all operations like it was before retirement. |
| 1485 ''' | 1485 ''' |
| 1486 if self.db.journaltag is None: | 1486 if self.db.journaltag is None: |
| 1487 raise DatabaseError, 'Database open read-only' | 1487 raise DatabaseError, 'Database open read-only' |
| 1488 | 1488 |
| 1489 node = self.db.getnode(self.classname, nodeid) | |
| 1490 # check if key property was overrided | |
| 1491 key = self.getkey() | |
| 1492 try: | |
| 1493 id = self.lookup(node[key]) | |
| 1494 except KeyError: | |
| 1495 pass | |
| 1496 else: | |
| 1497 raise KeyError, "Key property (%s) of retired node clashes with \ | |
| 1498 existing one (%s)" % (key, node[key]) | |
| 1499 | |
| 1489 self.fireAuditors('restore', nodeid, None) | 1500 self.fireAuditors('restore', nodeid, None) |
| 1490 | |
| 1491 # use the arg for __retired__ to cope with any odd database type | 1501 # use the arg for __retired__ to cope with any odd database type |
| 1492 # conversion (hello, sqlite) | 1502 # conversion (hello, sqlite) |
| 1493 sql = 'update _%s set __retired__=%s where id=%s'%(self.classname, | 1503 sql = 'update _%s set __retired__=%s where id=%s'%(self.classname, |
| 1494 self.db.arg, self.db.arg) | 1504 self.db.arg, self.db.arg) |
| 1495 if __debug__: | 1505 if __debug__: |
