comparison roundup/cgi/client.py @ 3388:0c66acaea802

present Reject exception messages to web users [SF#1237685]
author Richard Jones <richard@users.sourceforge.net>
date Mon, 18 Jul 2005 01:32:04 +0000
parents 2913b42c0810
children 8c113ca4a5fb
comparison
equal deleted inserted replaced
3386:263e8f485db5 3388:0c66acaea802
1 # $Id: client.py,v 1.214 2005-06-24 05:22:03 richard Exp $ 1 # $Id: client.py,v 1.215 2005-07-18 01:32:04 richard Exp $
2 2
3 """WWW request handler (also used in the stand-alone server). 3 """WWW request handler (also used in the stand-alone server).
4 """ 4 """
5 __docformat__ = 'restructuredtext' 5 __docformat__ = 'restructuredtext'
6 6
735 identifies the method on this object to call. The actions 735 identifies the method on this object to call. The actions
736 are defined in the "actions" sequence on this class. 736 are defined in the "actions" sequence on this class.
737 737
738 Actions may return a page (by default HTML) to return to the 738 Actions may return a page (by default HTML) to return to the
739 user, bypassing the usual template rendering. 739 user, bypassing the usual template rendering.
740
741 We explicitly catch Reject and ValueError exceptions and
742 present their messages to the user.
740 ''' 743 '''
741 if self.form.has_key(':action'): 744 if self.form.has_key(':action'):
742 action = self.form[':action'].value.lower() 745 action = self.form[':action'].value.lower()
743 elif self.form.has_key('@action'): 746 elif self.form.has_key('@action'):
744 action = self.form['@action'].value.lower() 747 action = self.form['@action'].value.lower()
753 # old way of specifying actions 756 # old way of specifying actions
754 return getattr(self, action_klass)() 757 return getattr(self, action_klass)()
755 else: 758 else:
756 return action_klass(self).execute() 759 return action_klass(self).execute()
757 760
758 except ValueError, err: 761 except (ValueError, Reject), err:
759 self.error_message.append(str(err)) 762 self.error_message.append(str(err))
760 763
761 def get_action_class(self, action_name): 764 def get_action_class(self, action_name):
762 if (hasattr(self.instance, 'cgi_actions') and 765 if (hasattr(self.instance, 'cgi_actions') and
763 self.instance.cgi_actions.has_key(action_name)): 766 self.instance.cgi_actions.has_key(action_name)):

Roundup Issue Tracker: http://roundup-tracker.org/