comparison roundup/cgi/client.py @ 4367:fa5587802af9

Handle multiple @action values from broken trackers
author Richard Jones <richard@users.sourceforge.net>
date Sat, 20 Mar 2010 04:29:45 +0000
parents 74476eaac38a
children 3fd24c10c2bb
comparison
equal deleted inserted replaced
4366:a0be2bc223f5 4367:fa5587802af9
731 """Check that the Anonymous user is actually allowed to use the web 731 """Check that the Anonymous user is actually allowed to use the web
732 interface and short-circuit all further processing if they're not. 732 interface and short-circuit all further processing if they're not.
733 """ 733 """
734 # allow Anonymous to use the "login" and "register" actions (noting 734 # allow Anonymous to use the "login" and "register" actions (noting
735 # that "register" has its own "Register" permission check) 735 # that "register" has its own "Register" permission check)
736
736 if ':action' in self.form: 737 if ':action' in self.form:
737 action = self.form[':action'].value.lower() 738 action = self.form[':action']
738 elif '@action' in self.form: 739 elif '@action' in self.form:
739 action = self.form['@action'].value.lower() 740 action = self.form['@action']
740 else: 741 else:
741 action = None 742 action = ''
743 if isinstance(action, list):
744 raise SeriousError('broken form: multiple @action values submitted')
745 else:
746 action = action.value.lower()
742 if action in ('login', 'register'): 747 if action in ('login', 'register'):
743 return 748 return
744 749
745 # allow Anonymous to view the "user" "register" template if they're 750 # allow Anonymous to view the "user" "register" template if they're
746 # allowed to register 751 # allowed to register
1113 1118
1114 We explicitly catch Reject and ValueError exceptions and 1119 We explicitly catch Reject and ValueError exceptions and
1115 present their messages to the user. 1120 present their messages to the user.
1116 """ 1121 """
1117 if ':action' in self.form: 1122 if ':action' in self.form:
1118 action = self.form[':action'].value.lower() 1123 action = self.form[':action']
1119 elif '@action' in self.form: 1124 elif '@action' in self.form:
1120 action = self.form['@action'].value.lower() 1125 action = self.form['@action']
1121 else: 1126 else:
1122 return None 1127 return None
1128
1129 if isinstance(action, list):
1130 raise SeriousError('broken form: multiple @action values submitted')
1131 else:
1132 action = action.value.lower()
1123 1133
1124 try: 1134 try:
1125 action_klass = self.get_action_class(action) 1135 action_klass = self.get_action_class(action)
1126 1136
1127 # call the mapped action 1137 # call the mapped action

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