Mercurial > p > roundup > code
comparison roundup/cgi/actions.py @ 5010:0428d2004a86
Fix exception handling to be python2.5 compatible
The exception handling introduced in commit hg:494d2550:
Display errors containing HTML with RejectRaw (issue2550847)
contained the new style of exception handling that is not compatible
with python2.5. Rework these exception handlers to use the old style to
maintain compatibility with python2.5
| author | John Kristensen <john@jerrykan.com> |
|---|---|
| date | Wed, 06 Jan 2016 16:02:34 +1100 |
| parents | 494d255043c9 |
| children | dce3cfe7ec61 |
comparison
equal
deleted
inserted
replaced
| 5009:3766e0ca8e7a | 5010:0428d2004a86 |
|---|---|
| 618 props, links = self.client.parsePropsFromForm() | 618 props, links = self.client.parsePropsFromForm() |
| 619 | 619 |
| 620 # handle the props | 620 # handle the props |
| 621 try: | 621 try: |
| 622 message = self._editnodes(props, links) | 622 message = self._editnodes(props, links) |
| 623 except (ValueError, KeyError, IndexError, Reject) as message: | 623 except (ValueError, KeyError, IndexError, Reject), message: |
| 624 escape = not isinstance(message, RejectRaw) | 624 escape = not isinstance(message, RejectRaw) |
| 625 self.client.add_error_message( | 625 self.client.add_error_message( |
| 626 self._('Edit Error: %s') % str(message), escape=escape) | 626 self._('Edit Error: %s') % str(message), escape=escape) |
| 627 return | 627 return |
| 628 | 628 |
| 664 | 664 |
| 665 # handle the props - edit or create | 665 # handle the props - edit or create |
| 666 try: | 666 try: |
| 667 # when it hits the None element, it'll set self.nodeid | 667 # when it hits the None element, it'll set self.nodeid |
| 668 messages = self._editnodes(props, links) | 668 messages = self._editnodes(props, links) |
| 669 except (ValueError, KeyError, IndexError, Reject) as message: | 669 except (ValueError, KeyError, IndexError, Reject), message: |
| 670 escape = not isinstance(message, RejectRaw) | 670 escape = not isinstance(message, RejectRaw) |
| 671 # these errors might just be indicative of user dumbness | 671 # these errors might just be indicative of user dumbness |
| 672 self.client.add_error_message(_('Error: %s') % str(message), | 672 self.client.add_error_message(_('Error: %s') % str(message), |
| 673 escape=escape) | 673 escape=escape) |
| 674 return | 674 return |
| 848 if self.db.config['INSTANT_REGISTRATION']: | 848 if self.db.config['INSTANT_REGISTRATION']: |
| 849 # handle the create now | 849 # handle the create now |
| 850 try: | 850 try: |
| 851 # when it hits the None element, it'll set self.nodeid | 851 # when it hits the None element, it'll set self.nodeid |
| 852 messages = self._editnodes(props, links) | 852 messages = self._editnodes(props, links) |
| 853 except (ValueError, KeyError, IndexError, Reject) as message: | 853 except (ValueError, KeyError, IndexError, Reject), message: |
| 854 escape = not isinstance(message, RejectRaw) | 854 escape = not isinstance(message, RejectRaw) |
| 855 # these errors might just be indicative of user dumbness | 855 # these errors might just be indicative of user dumbness |
| 856 self.client.add_error_message(_('Error: %s') % str(message), | 856 self.client.add_error_message(_('Error: %s') % str(message), |
| 857 escape=escape) | 857 escape=escape) |
| 858 return | 858 return |
