Mercurial > p > roundup > code
diff roundup/cgi/actions.py @ 8305:a81a3cd067fa
Generate savepoint only if necessary
Now some methods got an additional 'allow_abort' parameter. By default
this is True. When False the postgres backend generates a savepoint.
The methods are called with allow_abort=False from some of the cgi
methods which can produce a traceback when called with data from the
web-interface.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Sat, 01 Mar 2025 18:55:54 +0100 |
| parents | 261438b9c91c |
| children | e882a5d52ae5 |
line wrap: on
line diff
--- a/roundup/cgi/actions.py Sat Mar 01 13:08:09 2025 +0100 +++ b/roundup/cgi/actions.py Sat Mar 01 18:55:54 2025 +0100 @@ -661,8 +661,13 @@ cn, nodeid = needed if props: if nodeid is not None and int(nodeid) > 0: - # make changes to the node - props = self._changenode(cn, nodeid, props) + # make changes to the node, if an error occurs the + # db may be in a state that needs rollback + try: + props = self._changenode(cn, nodeid, props) + except (IndexError, ValueError): + self.db.rollback () + raise # and some nice feedback for the user if props:
