Skip to content

Commit 88172cf

Browse files
author
Richard Jones
committed
back out
1 parent 3246222 commit 88172cf

File tree

1 file changed

+21
-26
lines changed

1 file changed

+21
-26
lines changed

roundup/cgi/client.py

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $Id: client.py,v 1.198 2004-11-11 21:10:05 richard Exp $
1+
# $Id: client.py,v 1.199 2004-11-11 21:11:41 richard Exp $
22

33
"""WWW request handler (also used in the stand-alone server).
44
"""
@@ -641,26 +641,26 @@ def renderContext(self):
641641
return cgitb.pt_html(i18n=self.translator)
642642

643643
# these are the actions that are available
644-
actions = {
645-
'edit': EditItemAction,
646-
'editcsv': EditCSVAction,
647-
'new': NewItemAction,
648-
'register': RegisterAction,
649-
'confrego': ConfRegoAction,
650-
'passrst': PassResetAction,
651-
'login': LoginAction,
652-
'logout': LogoutAction,
653-
'search': SearchAction,
654-
'retire': RetireAction,
655-
'show': ShowAction,
656-
'export_csv': ExportCSVAction,
657-
}
644+
actions = (
645+
('edit', EditItemAction),
646+
('editcsv', EditCSVAction),
647+
('new', NewItemAction),
648+
('register', RegisterAction),
649+
('confrego', ConfRegoAction),
650+
('passrst', PassResetAction),
651+
('login', LoginAction),
652+
('logout', LogoutAction),
653+
('search', SearchAction),
654+
('retire', RetireAction),
655+
('show', ShowAction),
656+
('export_csv', ExportCSVAction),
657+
)
658658
def handle_action(self):
659659
''' Determine whether there should be an Action called.
660660
661661
The action is defined by the form variable :action which
662662
identifies the method on this object to call. The actions
663-
are defined in the "actions" dictionary on this class.
663+
are defined in the "actions" sequence on this class.
664664
665665
Actions may return a page (by default HTML) to return to the
666666
user, bypassing the usual template rendering.
@@ -678,17 +678,12 @@ def handle_action(self):
678678
# tracker-defined action
679679
action_klass = self.instance.cgi_actions[action]
680680
else:
681-
if isinstance(self.actions, type({})):
682-
if not self.actions.has_key(action):
683-
raise ValueError, 'No such action "%s"'%action
684-
action_class = self.actions[action]
681+
# go with a default
682+
for name, action_klass in self.actions:
683+
if name == action:
684+
break
685685
else:
686-
# backwards-compatible sequence
687-
for name, action_klass in self.actions:
688-
if name == action:
689-
break
690-
else:
691-
raise ValueError, 'No such action "%s"'%action
686+
raise ValueError, 'No such action "%s"'%action
692687

693688
# call the mapped action
694689
if isinstance(action_klass, type('')):

0 commit comments

Comments
 (0)